home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / bbs / bbbbs85.lha / rexx / bbsLOCAL.rexx < prev    next >
OS/2 REXX Batch file  |  1995-06-03  |  111KB  |  4,263 lines

  1. /*               $VER: bbsLOCAL.rexx 8.5 (3.6.95)
  2. bbsLOCAL.rexx 8.5 ⌐ 1990-95 Richard Lee Stockton 3 Jun 95 2:02PM
  3.     - FREELY DISTRIBUTABLE AS LONG AS THIS NOTICE REMAINS -
  4.  
  5.             BBBBS.baud without the BaudBandit stuff
  6.    Will multi-task with BBBBS.baud (within limits, see docs)
  7.  THIS IS THE SYSOP'S VERSION OF BBBBS.baud FOR LOCAL USE ONLY!
  8. */
  9.  
  10. copyright.=''
  11. copyright.1=STRIP(SOURCELINE(2))
  12. copyright.2='
  13. Gramma Software 21305-60th Ave West, Mountlake Terrace WA 98043-2009'
  14. copyright.3='
  15. ARexx portions of this software copyright 1990-93 Richard Lee Stockton'
  16. copyright.4='- FREELY DISTRIBUTABLE as long as this notice remains -'
  17.  
  18. /* If the QuickSortPort not found then try to run setup.rexx */
  19.  
  20. IF ~SHOW('P','QuickSortPort') THEN CALL setup.rexx()
  21. IF ~SHOW('P','QuickSortPort') THEN EXIT
  22.  
  23. IF SHOW('P','BBBBS_LOCAL') THEN
  24.   DO
  25.     SAY 'bbsLOCAL.rexx is already running!'
  26.     EXIT 0
  27.   END
  28. CALL OPENPORT('BBBBS_LOCAL')
  29.  
  30. CALL SETCLIP('BBS_mainfiles')
  31. CALL SETCLIP('BBS_mainusers')
  32.  
  33. PARSE VERSION . . cpu .
  34. cpu=RIGHT(cpu,2)/10
  35. IF cpu<1 THEN cpu=1
  36.  
  37. /* BBS Directories (may be created with SETUP option) */
  38. bbs.=''
  39. bbs.1='Information' /* text files from sysop for the user to read */
  40. bbs.6='Scratch'
  41. bbs.7='BBS_HELP'
  42. bbs.8='rexxDoors'
  43. bbs.9='BBS_TEXT'    /* text files for BBS use. WELCOME HELLO, NEW etc. */
  44. bbs.10='FileNotes'
  45. bbs.11='BBS_LIBS'
  46. bbs.12='BBS_MSGS'
  47. bbs.13='Lists'
  48. bbs.14='Numbers'    /* 1st & last messages, mail, files */
  49. bbs.15='Usage'
  50. bbs.16='Logs'
  51. bbs.17='EMailFiles'
  52. bbs.18='EMail'
  53. bbs.19='Users'
  54.  
  55.  
  56. /* VARIABLES */
  57.  
  58. RESET:
  59. bbsprefs.=0 /* start with all prefs OFF */
  60. namemask=COMPRESS(XRANGE(),XRANGE('A','Z')' _-')
  61. alpha.=''
  62. lastread.=0
  63. dirnum=1
  64. linesperpage=20
  65. sortuserflag=0
  66. sortalphaflag=0
  67. loadalphaflag=0
  68. savefileflag=0
  69. emailonline=-1
  70. level=0
  71. lastread.=0
  72. totwrit.=0
  73. lastbrowse=0
  74. warnings=0
  75. winnings=0
  76. nonstop=0
  77. libtext=1
  78. newfilesdate=''
  79. newpassword=''
  80. replysubj=''
  81. msgdir=1
  82. menuflag=1
  83. logonflag=1
  84. data.=''
  85. clr=''
  86. lineup='1B'x'M'
  87. lm='Loading Module...'lineup
  88.  
  89.  
  90. /* try to trap everything */
  91.  
  92. SIGNAL ON BREAK_C
  93. OPTIONS RESULTS
  94. OPTIONS FAILAT 999999
  95. SIGNAL ON BREAK_E
  96. SIGNAL ON SYNTAX
  97. SIGNAL ON FAILURE
  98. NUMERIC DIGITS 14
  99.  
  100.  
  101. ARG option .
  102.  
  103. SAY CENTER(copyright.1,75)
  104. CALL config()
  105.  
  106. IF ~EXISTS(bbspath'Numbers/FirstLogon') THEN
  107.   ADDRESS COMMAND 'C:Date >'bbspath'Numbers/FirstLogon'
  108.  
  109. SAY CENTER(copyright.2,75)
  110. SAY CENTER(copyright.3,75)
  111. SAY CENTER(copyright.4,75)
  112. SAY
  113.  
  114.  
  115. IF option='SETUP' THEN
  116.   DO
  117.     SAY 'Making sure all needed directories are here...'
  118.     DO i=1 TO 20
  119.       IF bbs.i~='' THEN CALL MAKEDIR(bbspath||bbs.i)
  120.     END
  121.   END
  122.  
  123. CALL colors(1)
  124. msg.=''
  125. IF readopen(bbspath'Lists/Conferences') THEN
  126.   DO
  127.     DO i=1
  128.       line=READLN(f)
  129.       IF line='END' THEN BREAK
  130.       IF EOF(f) THEN BREAK
  131.       num=WORD(line,1)
  132.       IF DATATYPE(num,'W') THEN msg.num=WORD(line,2)
  133.     END
  134.     CALL CLOSE(f)
  135.   END
  136. IF option='SETUP' THEN
  137.   DO
  138.     DO i=1 TO 99
  139.       IF msg.i~='' THEN CALL MAKEDIR(msgpath||i)
  140.     END
  141.   END
  142.  
  143. courtesy=''
  144. IF EXISTS(bbspath'Lists/Courtesy') THEN
  145.   DO
  146.     IF readopen(bbspath'Lists/Courtesy') THEN
  147.       DO
  148.         DO i=1
  149.           line=READLN(f)
  150.           IF EOF(f) THEN BREAK
  151.           courtesy=courtesy line
  152.         END
  153.         CALL CLOSE(f)
  154.       END
  155.   END
  156.  
  157. dirs.=''
  158. IF readopen(bbspath'Lists/Libraries') THEN
  159.   DO
  160.     DO i=1
  161.       line=READLN(f)
  162.       IF line='END' | EOF(f) THEN LEAVE i
  163.       num=WORD(line,1)
  164.       IF DATATYPE(num,'W') THEN dirs.num=STRIP(WORD(line,2))
  165.     END
  166.     CALL CLOSE(f)
  167.   END
  168. IF option='SETUP' THEN
  169.   DO
  170.     SAY 'Making sure all file library directories are here...'
  171.     DO i=1 TO 99
  172.       IF dirs.i~='' THEN
  173.         DO
  174.           CALL MAKEDIR(libpath||dirs.i)
  175.           CALL MAKEDIR(bbspath'FileNotes/'dirs.i)
  176.         END
  177.     END
  178.   END
  179.  
  180. users=0
  181. CALL sortuserlist()
  182.  
  183. SAY '          The larger the BBS gets, the longer the setup takes...'
  184.  
  185. CALL loadfiles()
  186. CALL set_grand()
  187. CALL loadalpha(1)
  188.  
  189.  
  190. BIG_LOOP:
  191. /** Identify (title) message */
  192. IF EXISTS(bbspath'BBS_TEXT/HELLO') THEN
  193.   DO
  194.     SAY 
  195.     CALL showtext(bbspath'BBS_TEXT/HELLO' 0)
  196.   END
  197. SAY
  198. SAY pen3'Courtesy List:'def
  199. SAY courtesy
  200. SAY
  201.  
  202.  
  203. /* Ask for name */
  204. name=''
  205. DO count=1 TO 3
  206.   name=getinput(1 0 'Please enter name: ')
  207.   name=SPACE(name,1,'_')
  208.   IF name='NEW' THEN LEAVE count
  209.   IF name~='' THEN
  210.     DO
  211.       IF EXISTS(bbspath'Users/'name) THEN LEAVE count
  212.       IF EXISTS(bbspath'Morgue/'name'.lha') THEN
  213.         DO
  214.           SAY
  215.           SAY name 'used to a member of this BBS.'
  216.           SAY 'If that is you, you will have to resurrect yourself...'
  217.           IF getinput(1 1 'Resurrect' name'? (Ny) > ')='Y' THEN
  218.             DO
  219.               dd=WORD(STATEF(bbspath'Morgue/'name'.lha'),5)
  220.               dd=DATE(,dd,'I')
  221.               SAY 'Resurrecting a dead user.  Killed' dd '...'
  222.               ADDRESS COMMAND 'CD' bbspath'0A'x||'lha x Morgue/'name'.lha'
  223.               CALL DELETE(bbspath'Morgue/'name'.lha')
  224.               CALL send2log('RESURRECTED:' name 'who was killed' dd)
  225.               LEAVE count
  226.             END
  227.         END
  228.       IF FIND(exclusion,name)>0 THEN
  229.         DO
  230.           SAY 'Sorry, that is a reserved name.'
  231.           name=''
  232.           ITERATE count
  233.         END
  234.       CALL loadcourtesy()
  235.       IF bbsprefs.7>0 | FIND(courtesy,name)>0 THEN
  236.         DO
  237.           SAY
  238.           SAY 'Welcome' name'!'
  239.           SAY 'You will be automatically validated after you enter your user info.'
  240.           SAY
  241.           LEAVE count
  242.         END
  243.     END
  244.   IF count<3 THEN
  245.     DO
  246.       IF STRIP(name)~='' THEN SAY name 'not found.  Please try again.'
  247.       SAY 'New Users enter NEW to apply for validation.'
  248.     END
  249. END
  250. IF count>3 THEN SIGNAL DONE
  251. CALL checkUser()
  252. IF UPPER(WORD(data.12,3))~='BIRTHDAY:' THEN
  253.   DO
  254.     SAY
  255.     SAY 'Please help us out by entering the following information.'
  256.     CALL getbirth()
  257.     SAY '   Thank you!'
  258.   END
  259. CALL checkclips()
  260. city=docity(data.3)
  261.  
  262. CALL TIME('R')
  263.  
  264. IF RIGHT(WORD(data.12,4),4)=RIGHT(DATE('S'),4) THEN
  265.   DO
  266.     arg=bbspath'BBS_TEXT/BIRTHDAY'
  267.     IF EXISTS(arg) THEN 
  268.       DO
  269.         SAY
  270.         CALL showtext(arg 1)
  271.       END
  272.     SAY
  273.     SAY '***  Happy Birthday,' pen3||data.1||def', and many more!  ***'
  274.     SAY
  275.   END
  276. SAY 
  277.  
  278. CALL SETCLIP('BBS_LOCAL',name)
  279. IF EXISTS('rexx:bbs:LOGON.rexx') THEN CALL bbsLOGON.rexx(name level)
  280. CALL sortlibraries()
  281. CALL sortconferences()
  282. IF FIND(data.8,'QUICK')>0 THEN CALL do_quick(0)
  283.  
  284.  
  285. /*
  286. Opening Display after logon. Seen by all Users ONCE A DAY. It first
  287. looks for a unique yearly data (ie, WELCOME.0704), then daily data
  288. (ie, WELCOME.Fri), and then a simple, everyday 'WELCOME' datafile.
  289. */
  290.  
  291. IF DATE('I')>lastondate THEN
  292.   DO
  293.     SAY
  294.     arg=bbspath'BBS_TEXT/WELCOME.'RIGHT(DATE('S'),4)
  295.     CALL showtext(arg 1)
  296.     SAY
  297.     arg=bbspath'BBS_TEXT/WELCOME.'LEFT(DATE('W'),3)
  298.     CALL showtext(arg 1)
  299.     SAY
  300.     arg=bbspath'BBS_TEXT/WELCOME'
  301.     CALL showtext(arg 1)
  302.  
  303. /*
  304. Looks for files in the format  LEVEL.low-high, ie "LEVEL.50-80" will only
  305. be seen by users with a level >= 50 and <= 80.
  306. */
  307.  
  308.     levels.=''
  309.     IF FileList(bbspath'BBS_TEXT/LEVEL.*',levels)>0 THEN
  310.       DO
  311.         DO ui=1 TO levels.0
  312.           p=LASTPOS('.',levels.ui)
  313.           x=SUBSTR(levels.ui,p+1)
  314.           PARSE VAR x lo'-'hi .
  315.           IF ~DATATYPE(lo,'W') | ~DATATYPE(hi,'W') THEN ITERATE ui
  316.           IF lo>level | hi<level THEN ITERATE ui
  317.           DO
  318.             SAY
  319.             CALL showtext(levels.ui 1)
  320.           END
  321.         END
  322.       END
  323.  
  324. /*
  325. Looks for format UNTIL.YYYYMMDD ie, "UNTIL.19920514"
  326. Deletes any that are previous to "today"
  327. */
  328.  
  329.     untils.=''
  330.     IF FileList(bbspath'BBS_TEXT/UNTIL.*',untils)>0 THEN
  331.       DO
  332.         CALL QSORT(1,untils.0,untils)
  333.         DO ui=1 TO untils.0
  334.           IF RIGHT(untils.ui,8)<DATE('S') THEN CALL DELETE(untils.ui)
  335.           ELSE
  336.             DO
  337.               SAY
  338.               CALL showtext(untils.ui 1)
  339.             END
  340.         END
  341.       END
  342.     DROP untils.
  343.   END
  344.  
  345. IF bbsprefs.1 & ~terseflag THEN
  346.   DO
  347.     IF doGrin()>3 THEN CALL waiting()
  348.     IF EXISTS(bbspath'rexxDoors/Moon.rexx') THEN CALL Moon.rexx()
  349.     IF EXISTS(bbspath'rexxDoors/Time.rexx') THEN CALL Time.rexx()
  350.     IF FIND(UPPER(SHOWLIST('A')),'TODAY')>0 THEN
  351.       DO
  352.         tf=scratch'/TODAY'
  353.         finfo=STATEF(tf)
  354.         IF WORD(finfo,5)~=DATE('I') THEN
  355.           ADDRESS COMMAND 'C:Today091 >'tf
  356.         IF EXISTS(tf) THEN CALL showtext(tf 0)
  357.       END
  358.     SAY
  359.   END
  360.  
  361. IF SHOWDIR(bbspath'Email/'name)~='' THEN CALL readmail(0)
  362. ELSE SAY 'Your mailbox is empty.'
  363. IF ~terseflag THEN
  364.   DO
  365.     IF level>sysoplevel THEN
  366.       DO
  367.         lstmail=WORD(data.17,3)
  368.         IF ~DATATYPE(lstmail,'W') THEN lstmail=0
  369.         IF countcheck('LastMail' 0)>lstmail THEN
  370.           IF getinput(1 1 'Check Email? (Ny) > ')='Y' THEN CALL mailreport()
  371.         IF level<99 THEN
  372.           DO
  373.             SAY
  374.             CALL showtext(bbspath'Email/'sysop'/NEW_FILES' 1)
  375.           END
  376.         SAY
  377.         CALL showtext(bbspath'Lists/NEW_USERS' 1)
  378.         CALL showtext(bbspath'Lists/CBV_USERS' 1)
  379.       END
  380.     CALL logonstats()
  381.     CALL newinfo()
  382.   END
  383. CALL showmarked(1)
  384. CALL setdir(libpath||dirs.1)
  385. logonflag=0
  386.  
  387.  
  388. /***** MAIN *****/
  389.  
  390. IF menu~='ALL' THEN menu='MAIN'
  391.  
  392. RESTART:
  393. SIGNAL ON BREAK_C
  394. SIGNAL ON BREAK_E
  395.  
  396. waitchar=''
  397. string=''
  398. opt=''
  399. IF level<1 THEN menu='NEW'
  400. DO WHILE(opt~='G')
  401.   go=0
  402.   DO WHILE(~go)
  403.     IF waitchar='' | waitchar='?' THEN
  404.       DO
  405.         commands='cghiqsvwxyz!#,'
  406.         IF level>0  THEN commands='abcdefghijlmnoprstuvwxyz!$#&.,+'
  407.         ELSE IF SHOWDIR(bbspath'Email/'name)~='' THEN commands=commands'e'
  408.         IF level>sysoplevel THEN commands=commands'k%^()=;'
  409.         IF level=99 THEN commands=commands'@~'
  410.         commands=commands'?'
  411.         IF menuflag | waitchar='?' | string='?' THEN
  412.           DO
  413.             opt='MENU'
  414.             arg=''
  415.             CALL menus()
  416.           END
  417.         ELSE SAY pen3'COMMANDS:'def commands
  418.       END
  419.     line=''
  420.     line=line||bak2' 'TIME('C')' 'def
  421.     IF menu='ALL' | menu='FILE' THEN
  422.       line=line pen3'FILE_LIBRARY:'plaindir||def
  423.     ELSE IF menu='MSG' THEN line=line pen3'MESSAGES:'def
  424.     ELSE line=line pen3'MAIN:'def
  425.     line=line'  'bbsname
  426.     IF waitchar='' THEN waitchar=getinput(0 0 line' > ')
  427.     PARSE VAR waitchar string' 'arg
  428.     nonstop=0
  429.     string=UPPER(STRIP(string))
  430.     IF clr~='' THEN SAY clr
  431.     x=GETCLIP('BBS_LOCAL_MSG')
  432.     IF x~='' THEN
  433.       DO
  434.         CALL SETCLIP('BBS_LOCAL_MSG')
  435.         SAY
  436.         SAY bak2' Message from BBBBS: 'def
  437.         SAY x
  438.         SAY
  439.         CALL waiting()
  440.       END
  441.     IF string='OFF' | string='BYE' THEN SIGNAL LOGOUT
  442.     IF string='FL' & level>0 THEN CALL bbsFriends.rexx(name colorflag)
  443.     CALL checkalias()
  444.     IF LEFT(string,1)='D' THEN
  445.       IF DATATYPE(SUBSTR(string,2),'W') THEN arg=SUBSTR(string,2) arg
  446.     waitchar=''
  447.     IF DATATYPE(string,'W') THEN
  448.       DO
  449.         IF string>level THEN
  450.           DO
  451.             arg=STRIP(string arg)
  452.             string='D'
  453.           END
  454.         ELSE
  455.           DO
  456.             dirnum=string
  457.             CALL chdir2()
  458.             CALL since()
  459.           END
  460.       END
  461.     IF string='QUICK' & level>0 THEN CALL do_quick(1)
  462.     opt=LEFT(string,1)
  463.     go=1
  464.     IF POS(opt,UPPER(commands))=0 THEN go=0
  465.   END
  466.   t=bbspath'BBS_TEXT/COM.'opt
  467.   IF UPPER(arg)='EDIT' THEN CALL edinfo(t,opt,'Menu Command')
  468.   IF ~terseflag THEN CALL showtext(t 1)
  469.   OPTIONS PROMPT 'Filename: '
  470.   SELECT
  471.     WHEN opt='A' THEN CALL showalpha()
  472.     WHEN opt='B' THEN CALL browse()
  473.     WHEN opt='C' THEN CALL editor(name 3000 'MAIL' sysop . 0 0 'FEEDBACK')
  474.     WHEN opt='D' THEN CALL dload()
  475.     WHEN opt='E' THEN CALL readmail(level>0)
  476.     WHEN opt='F' THEN CALL do_F()
  477.     WHEN opt='H' THEN CALL help('MAIN')
  478.     WHEN opt='I' THEN CALL information()
  479.     WHEN opt='J' THEN CALL jump2rexx()
  480.     WHEN opt='K' THEN CALL killuser()
  481.     WHEN opt='L' THEN CALL list()
  482.     WHEN opt='M' THEN IF menu~='ALL' THEN menu='MSG'
  483.     WHEN opt='N' THEN CALL newfiles()
  484.     WHEN opt='O' THEN CALL otheruser()
  485.     WHEN opt='P' THEN CALL editor(name 3000 'MSG' . . 0 0)
  486.     WHEN opt='R' THEN CALL readmessages()
  487.     WHEN opt='S' THEN CALL bbsSEARCH()
  488.     WHEN opt='U' THEN CALL uload(1)
  489.     WHEN opt='V' THEN CALL showtext(bbspath'Usage/USER.LOG' 1)
  490.     WHEN opt='W' THEN CALL showuserlist()
  491.     WHEN opt='X' THEN CALL switchmenuflag()
  492.     WHEN opt='Y' THEN CALL edituser()
  493.     WHEN opt='Z' THEN CALL counts()
  494.     WHEN opt='~' THEN CALL sysED(1)
  495.     WHEN opt='@' THEN CALL shell()
  496.     WHEN opt='#' THEN CALL switchcolors()
  497.     WHEN opt='$' THEN IF menu='ALL' THEN menu='MAIN'; ELSE menu='ALL'
  498.     WHEN opt='%' THEN CALL editnote()
  499.     WHEN opt='^' THEN CALL readlogs()
  500.     WHEN opt='&' THEN CALL bbsProfiles.rexx(name level sysoplevel 20 1 6000 bbspath)
  501.     WHEN opt=';' THEN CALL changename()
  502.     WHEN opt='(' THEN CALL filereport()
  503.     WHEN opt=')' THEN CALL mailreport()
  504.     WHEN opt='=' THEN CALL levelreport()
  505.     WHEN opt='+' THEN CALL ext_dload()
  506.     WHEN opt='.' THEN menu='MAIN'
  507.     WHEN opt=',' THEN DO;CALL hourly();CALL waiting();END
  508.     WHEN opt='?' & menuflag THEN CALL help('MAIN')
  509.     OTHERWISE NOP
  510.   END
  511. END
  512. SIGNAL LOGOUT
  513. EXIT
  514.  
  515.  
  516.  
  517. /* FUNCTIONS */
  518.  
  519.  
  520. do_F:
  521. IF menu='FILE' | menu='ALL' THEN
  522.   DO
  523.     IF STORAGE()<(bbsprefs.15+100000) | GETCLIP('BBS_libs.0')~='' THEN
  524.       DO
  525.         SAY
  526.         SAY 'Sorry! Not enough memory left for background archiving.'
  527.         SAY 'Please try again in 10 minutes or so.'
  528.         SAY
  529.         RETURN
  530.       END
  531.     DO i=0 TO libs.0
  532.       CALL SETCLIP('BBS_libs.'i,libs.i)
  533.     END
  534.     IF Make_BrowseList.baud(name colorflag files.0)=0 THEN
  535.       IF emailonline>=0 THEN emailonline=emailonline+1
  536.     DO i=0 TO libs.0
  537.       CALL SETCLIP('BBS_libs.'i)
  538.     END
  539.   END
  540. ELSE IF menu~='ALL' THEN menu='FILE'
  541. RETURN
  542.  
  543.  
  544. cleanstring:
  545. PARSE ARG nflag':'cstr
  546. IF nflag=1 THEN
  547.   DO
  548.     cstr=COMPRESS(cstr,"'`")
  549.     cstr=TRANSLATE(cstr,,namemask)
  550.     cstr=SPACE(cstr,1,'_')
  551.     RETURN cstr
  552.   END
  553. bot=XRANGE(,'1F'x)
  554. IF nflag=2 THEN bot=COMPRESS(bot,'1B'x)  /* ESC for ANSI */
  555. ELSE cstr=strip_ansi(cstr)
  556. top=XRANGE('7F'x)
  557. cstr=COMPRESS(cstr,bot||top)
  558. IF nflag=0 THEN cstr=STRIP(cstr)
  559. RETURN cstr
  560.  
  561.  
  562. showtext:
  563. PARSE ARG starg warg .
  564. IF EXISTS(starg'.'colorflag) THEN
  565.   DO
  566.     IF OPEN(f,starg'.'colorflag,'R')=0 THEN RETURN
  567.     t=READCH(f,65000)
  568.     CALL CLOSE(f)
  569.     SAY t
  570.   END
  571. ELSE IF EXISTS(starg) THEN
  572.   DO
  573.     CALL readlines(starg 1)
  574.     IF colorflag=0 THEN CALL strip_lynes()
  575.     CALL seelines(1)
  576.   END
  577. ELSE RETURN
  578. IF warg THEN
  579.   DO
  580.     CALL waiting()
  581.     nonstop=0
  582.   END
  583. RETURN
  584.  
  585.  
  586. strip_lynes:
  587. DO i=1 TO lynes.0
  588.   lynes.i=strip_ansi(lynes.i)
  589. END
  590. RETURN
  591.  
  592.  
  593. strip_ansi:
  594. PARSE ARG aline 
  595. n=POS('1B'x,aline)
  596. DO WHILE n>0
  597.   DO k=2
  598.     IF DATATYPE(SUBSTR(aline,n+k,1),'M') | (n+k+1)>LENGTH(aline) THEN
  599.       leave k
  600.   END
  601.   aline=DELSTR(aline,n,k+1)
  602.   n=POS('1B'x,aline)
  603. END
  604. RETURN aline
  605.  
  606.  
  607. doGrin:
  608. IF ~EXISTS(bbspath'rexxDoors/Grin_du_Jour.rexx') THEN RETURN 0
  609. CALL setdir(bbspath'rexxDoors')
  610. temp=Grin_du_Jour.rexx()
  611. SAY
  612. RETURN temp
  613.  
  614.  
  615. do_quick:
  616. ARG flag .
  617. IF FIND(UPPER(data.8),'QUICK')=0 THEN
  618.   DO
  619.     SAY
  620.     SAY 'The QUICK option is OFF in your current settings.'
  621.     SAY
  622.     SAY 'Setting the QUICK option to ON will allow you to tell the BBS to'
  623.     SAY 'make a .lha archive of all new bbs activity since your last call.'
  624.     SAY
  625.     SAY 'This archive can then be read (and replied to, and files can be'
  626.     SAY 'uploaded and downloaded) using 'pen3'bbsQUICK.rexx'def', the offline read/reply'
  627.     SAY 'module for BBBBS, which is available here in the file libraries.'
  628.     SAY
  629.     IF getinput(1 1 'Turn the QUICK option ON? (Ny) > ')~='Y' THEN RETURN
  630.     data.8=data.8 'QUICK'
  631.     CALL saveData(0)
  632.   END
  633. ELSE IF flag=1 THEN
  634.   DO
  635.     IF getinput(1 1 'Turn the QUICK option OFF? (Ny) > ')='Y' THEN
  636.       DO 
  637.         temp=data.8
  638.         data.8=''
  639.         DO i=1 TO WORDS(temp)
  640.           IF WORD(temp,i)~='QUICK' THEN data.8=STRIP(data.8 WORD(temp,i))
  641.         END
  642.         ADDRESS COMMAND 'c:delete' bbspath'EmailFiles/'name'/QUICK_#?'
  643.         RETURN
  644.       END
  645.   END
  646. IF getinput(1 1 'Edit your QUICK exclude list? (Ny) > ')='Y' THEN
  647.   DO
  648.     SAY
  649.     SAY 'You may EXCLUDE any of these from your QUICK archives.'
  650.     SAY pen3||LEFT('-',74,'-')||def
  651.     temp=LEFT(' ',7)
  652.     SAY temp'HELLO          - Pre-logon message.'
  653.     SAY temp'WELCOME        - Post-logon message.'
  654.     SAY temp'GOODBYE        - Logoff message.'
  655.     SAY temp'HOURLY         - Average-Minutes-Per-Hour usage graph.'
  656.     SAY temp'STATS.BBS      - Most of the Z command from the main menu.'
  657.     SAY temp'filename       - ANY filename in the Information area.'
  658.     SAY temp'MESSAGES       - New conference messages.'
  659.     SAY temp'FILELIST       - New file descriptions.'
  660.     SAY pen3||LEFT('-',74,'-')||def
  661.     SAY 'Enter a space separated list of what you wish to exclude.'
  662.     SAY pen3'Exclude:'def data.26
  663.     temp=getinput(1 0 pen3'Exclude: 'def)
  664.     IF temp='' & data.26~='' THEN
  665.       DO
  666.         IF getinput(1 1 'Clear the QUICK exclude list? (nY) > ')~='N' THEN
  667.           data.26=''
  668.       END
  669.     ELSE data.26=temp
  670.     temp='Your QUICK archives will exclude'pen3
  671.     IF data.26='' THEN temp=temp 'nothing!'
  672.     ELSE temp=temp data.26
  673.     SAY temp||def
  674.     CALL saveData(0)
  675.     SAY
  676.   END
  677. IF GETCLIP('BBS_'name)~='' THEN
  678.   DO
  679.     SAY
  680.     SAY 'The QUICK routines are still working on your archive...'
  681.     SAY 'Please try again later.'
  682.     SAY
  683.     RETURN
  684.   END
  685. quickdir=bbspath'EmailFiles/'name
  686. CALL MAKEDIR(quickdir)
  687. CALL setdir(quickdir)
  688. qdarg=scratch'/dirlist'
  689. ADDRESS COMMAND 'C:list >'qdarg quickdir'/QUICK_#? DATES'
  690. efiles=UPPER(SHOWDIR(quickdir))
  691. qflag=0
  692. das=0
  693. IF getinput(1 1 'Archive new BBS activity now? (Ny) > ')='Y' THEN
  694.   DO
  695.     das=1
  696.     DO i=1 TO WORDS(efiles)
  697.       qarg=WORD(efiles,qi)
  698.       IF LEFT(qarg,6)='QUICK_' & RIGHT(qarg,4)='.LHA' THEN
  699.         DO
  700.           SAY
  701.           SAY 'There is already a QUICK_xxxxx.LHA file in your mailbox...'
  702.           SAY 'Activity request has been CANCELLED!'
  703.           SAY
  704.           das=0
  705.           LEAVE i
  706.         END
  707.     END
  708.   END
  709. IF das=1 THEN
  710.   DO
  711.     CALL SETCLIP('BBS_city',city)
  712.     CALL SETCLIP('BBS_'name'_26',data.26)
  713.     IF FIND(UPPER(data.26),'STATS.BBS')=0 THEN
  714.       CALL SETCLIP('BBS_statsarg',emailonline grand grand2 files.0)
  715.     IF FIND(UPPER(data.26),'MESSAGES')=0 THEN
  716.       CALL SETCLIP('BBS_'name'_22',data.22)
  717.     CALL MAKEDIR(bbspath'EmailFiles/'name)
  718.     CALL showmarked(0)
  719.     CALL SETCLIP('BBS_QUICKOUT_BAUD',bps)
  720.     ADDRESS AREXX bbsQUICKOUT.rexx name level lastbrowse WORD(data.16,2) data.21
  721.     IF FIND(UPPER(data.26),'MESSAGES')=0 THEN
  722.       DO
  723.         clear_marked=1
  724.         DO i=1 TO level
  725.           IF WORD(data.22,i)~=-1 THEN
  726.             lastread.i=countcheck('LastMessage'i 0)
  727.         END
  728.         SAY
  729.       END
  730.     IF FIND(UPPER(data.26),'FILELIST')=0 THEN
  731.       lastbrowse=countcheck('LastFile' 0)
  732.     newfilesdate=DATE('S') TIME()
  733.     IF writeopen(bbspath'EmailFiles/'name'/Libraries') THEN
  734.       DO
  735.         DO i=1 TO libs.0
  736.           CALL WRITELN(f,libs.i)
  737.         END
  738.         CALL CLOSE(f)
  739.       END
  740.     IF writeopen(bbspath'EmailFiles/'name'/Conferences') THEN
  741.       DO
  742.         DO i=1 TO msgs.0
  743.           CALL WRITELN(f,msgs.i)
  744.         END
  745.         CALL CLOSE(f)
  746.       END
  747.     SAY
  748.     CALL saveData(1)
  749.     qflag=1
  750.   END
  751. IF WORD(STATEF(qdarg),2)>80 THEN
  752.   DO
  753.     CALL showtext(qdarg 0)
  754.     SAY
  755.   END
  756. DO qi=1 TO WORDS(efiles)
  757.   qarg=WORD(efiles,qi)
  758.   IF LEFT(qarg,6)='QUICK_' & RIGHT(qarg,4)='.LHA' THEN
  759.     DO
  760.       SAY qarg 'is' WORD(STATEF(qarg),2) 'bytes.'
  761.       arg=qarg
  762.       DO WHILE dload()=1
  763.       END
  764.       t=''
  765.       DO WHILE t~='N' & t~='Y'
  766.         t=getinput(1 1 'Delete' qarg'? (ny) > ')
  767.       END
  768.       IF t='Y' THEN
  769.         DO
  770.           IF DELETE(quickdir'/'qarg)=1 THEN SAY qarg 'deleted.'
  771.           CALL DELETE(quickdir'/'qarg'.xdl')
  772.           qarg=COMPRESS(UPPER(qarg),'QUICK_.LHA')
  773.           CALL DELETE(bbspath'Email/'name'/BBBBS.'qarg)
  774.         END
  775.     END
  776. END
  777. arg=''
  778. IF getinput(1 1 'Do you have a QUICKIN file to upload? (Ny) > ')='Y' THEN
  779.   DO
  780.     arg='QUICKIN.lha'
  781.     ul=2
  782.     DO WHILE ul=2
  783.       ul=uload(0)
  784.     END
  785.   END
  786. IF EXISTS(bbspath'EmailFiles/'name'/QUICKIN.lha') & level>=sysoplevel THEN
  787.   IF getinput(1 1 'Process your QUICKIN archive [N]ow or at [L]ogoff? (Ln) > ')='N' THEN
  788.     DO
  789.       SAY
  790.       SAY 'Please wait, processing QUICKIN archive...'
  791.       CALL bbsQUICKIN.rexx(name level sysoplevel bbsprefs.6)
  792.       CALL checkclips()
  793.       CALL loaddata()
  794.       SAY
  795.     END
  796. IF getinput(1 1 'Logoff Now? (nY) > ')~='N' THEN
  797.   DO
  798.     IF qflag THEN SAY 'Your archive will be waiting next time you call...'
  799.     SAY
  800.     SIGNAL LOGOUT2
  801.   END
  802. IF qflag THEN
  803.   DO
  804.     SAY
  805.     SAY 'Note: You now have no ''new'' files or messages (they are being archived).'
  806.     SAY
  807.     CALL waiting()
  808.   END
  809. RETURN
  810.  
  811.  
  812. killuser:
  813. ARG kname .
  814. IF level<=sysoplevel THEN RETURN
  815. CALL bbsKillUser.rexx(kname)
  816. RETURN
  817.  
  818.  
  819. menus:
  820. IF OPEN(f,bbspath'BBS_TEXT/MENU_'menu'.'colorflag,'R')~=0 THEN
  821.   DO
  822.     m=READCH(f,65000)
  823.     CALL CLOSE(f)
  824.     SAY m
  825.     IF level>sysoplevel THEN
  826.       DO
  827.         SAY ' ['pen3'K'def']ill a user      ['pen3'%'def'] edit filenote  ['pen3'='def'] level report'def
  828.         SAY ' ['pen3'^'def'] view BBS logs  ['pen3'('def'] file report    ['pen3';'def'] change username'def
  829.       END
  830.     IF level=99 THEN
  831.       SAY ' ['pen3'~'def'] online editor  ['pen3'@'def'] dos shell      ['pen3')'def'] email report'def
  832.   END
  833. ELSE IF menu='NEW' THEN
  834.   DO
  835.     SAY pen6'     _________________'def
  836.     SAY pen6'  __/  'pen3'New User Menu'pen6'  \___'def
  837.     SAY pen6' |                        |'def
  838.     SAY pen6' |'def'   ['pen3'H'def']elp               'pen6'|'def
  839.     SAY pen6' |'def'   ['pen3'I'def']nformation        'pen6'|'def
  840.     SAY pen6' |'def'   ['pen3'Y'def']our user data     'pen6'|'def
  841.     SAY pen6' |'def'   ['pen3'W'def']ho is here        'pen6'|'def
  842.     SAY pen6' |'def'   ['pen3'S'def']earch user list   'pen6'|'def
  843.     SAY pen6' |'def'   ['pen3'V'def']iew user log      'pen6'|'def
  844.     SAY pen6' |'def'   ['pen3'Z'def'] bbs statistics   'pen6'|'def
  845.     SAY pen6' |'def'   ['pen3','def'] hourly stats     'pen6'|'def
  846.     SAY pen6' |'def'   ['pen3'X'def'] toggle menus     'pen6'|'def
  847.     SAY pen6' |'def'   ['pen3'#'def'] toggle color     'pen6'|'def
  848.     SAY pen6' |'def'   ['pen3'!'def'] YELL for SYSOP   'pen6'|'def
  849.     SAY pen6' |'def'   ['pen3'C'def']omment to SYSOP   'pen6'|'def
  850.     SAY pen6' |'def'   ['pen3'G'def']oodbye (hangup)   'pen6'|'def
  851.     SAY pen6' |________________________|'def
  852.     IF SHOWDIR(bbspath'Email/'name)~='' THEN
  853.       DO
  854.         SAY CR
  855.         SAY 'You have unread EMail waiting!'
  856.         SAY 'Enter E to read ['pen3'E'def']mail.'
  857.       END
  858.   END
  859. ELSE IF menu='MSG' THEN
  860.   DO
  861.     SAY pen6'       ____________'def
  862.     SAY pen6'  ____/  'pen3'Messages'pen6'  \_____'def
  863.     SAY pen6' |                       |'def
  864.     SAY pen6' |'def'   ['pen3'H'def']elp              'pen6'|'def
  865.     SAY pen6' |'def'   ['pen3'P'def']ost messages     'pen6'|'def
  866.     SAY pen6' |'def'   ['pen3'R'def']ead messages     'pen6'|'def
  867.     SAY pen6' |'def'   ['pen3'S'def']earch messages   'pen6'|'def
  868.     SAY pen6' |'def'   ['pen3'E'def']mail (private)   'pen6'|'def
  869.     SAY pen6' |'def'   ['pen3'C'def']omment to SYSOP  'pen6'|'def
  870.     SAY pen6' |'def'   ['pen3'QUICK'def'] options     'pen6'|'def
  871.     SAY pen6' |'def'   ['pen3'FL'def'] Friends List   'pen6'|'def
  872.     SAY pen6' |'def'   ['pen3'!'def'] YELL for SYSOP  'pen6'|'def
  873.     IF(level>sysoplevel) THEN DO
  874.     SAY pen6' |'def'   ['pen3'^'def'] view BBS logs   'pen6'|'def
  875.     SAY pen6' |'def'   ['pen3')'def'] email report    'pen6'|'def
  876.     SAY pen6' |'def'   ['pen3'='def'] level report    'pen6'|'def
  877.     SAY pen6' |'def'   ['pen3';'def'] change username 'pen6'|'def;END
  878.     IF(level=99) THEN DO
  879.     SAY pen6' |'def'   ['pen3'~'def'] online editor   'pen6'|'def
  880.     SAY pen6' |'def'   ['pen3'@'def'] dos shell       'pen6'|'def;END
  881.     SAY pen6' |'def'   ['pen3'F'def']iles menu        'pen6'|'def
  882.     SAY pen6' |'def'   ['pen3'.'def'] main menu       'pen6'|'def
  883.     SAY pen6' |_______________________|'def
  884.   END
  885. ELSE IF menu='FILE' THEN
  886.   DO
  887.     SAY pen6'         _________'def
  888.     SAY pen6'  ______/  'pen3'Files'pen6'  \_______'def
  889.     SAY pen6' |                        |'def
  890.     SAY pen6' |'def'   ['pen3'A'def']lphabetic list    'pen6'|'def
  891.     SAY pen6' |'def'   ['pen3'H'def']elp               'pen6'|'def
  892.     SAY pen6' |'def'   ['pen3'B'def']rowse filenotes   'pen6'|'def
  893.     SAY pen6' |'def'   ['pen3'N'def']ew files list     'pen6'|'def
  894.     SAY pen6' |'def'   ['pen3'L'def']ist by Library    'pen6'|'def
  895.     SAY pen6' |'def'   ['pen3'F'def']ilelist archives  'pen6'|'def
  896.     SAY pen6' |'def'   ['pen3'S'def']earch files       'pen6'|'def
  897.     SAY pen6' |'def'   ['pen3'U'def']pload             'pen6'|'def
  898.     SAY pen6' |'def'   ['pen3'D'def']ownload           'pen6'|'def
  899.     SAY pen6' |'def'   ['pen3'+'def'] Extra Devices    'pen6'|'def
  900.     IF(level>sysoplevel) THEN DO
  901.     SAY pen6' |'def'   ['pen3'K'def']ill a user        'pen6'|'def
  902.     SAY pen6' |'def'   ['pen3'%'def'] edit filenote    'pen6'|'def
  903.     SAY pen6' |'def'   ['pen3'('def'] file report      'pen6'|'def
  904.     SAY pen6' |'def'   ['pen3';'def'] change username  'pen6'|'def;END
  905.     IF(level=99) THEN
  906.     SAY pen6' |'def'   ['pen3'@'def'] dos shell        'pen6'|'def
  907.     SAY pen6' |'def'   ['pen3'M'def']essages menu      'pen6'|'def
  908.     SAY pen6' |'def'   ['pen3'.'def'] main menu        'pen6'|'def
  909.     SAY pen6' |________________________|'def
  910.   END
  911. ELSE IF menu='MAIN' THEN
  912.   DO
  913.     SAY pen6'       _____________'def
  914.     SAY pen6'  ____/  'pen3'Main Menu'pen6'  \_____'def
  915.     SAY pen6' |                        |'def
  916.     SAY pen6' |'def'   ['pen3'H'def']elp               'pen6'|'def
  917.     SAY pen6' |'def'   ['pen3'I'def']nfomation         'pen6'|'def
  918.     SAY pen6' |'def'   ['pen3'J'def']ump to doorways   'pen6'|'def
  919.     SAY pen6' |'def'   ['pen3'Y'def']our user data     'pen6'|'def
  920.     SAY pen6' |'def'   ['pen3'W'def']ho is here list   'pen6'|'def
  921.     SAY pen6' |'def'   ['pen3'S'def']earch userlist    'pen6'|'def
  922.     SAY pen6' |'def'   ['pen3'O'def']ther users info   'pen6'|'def
  923.     SAY pen6' |'def'   ['pen3'V'def']iew user log      'pen6'|'def
  924.     SAY pen6' |'def'   ['pen3'X'def']pert (no menus)   'pen6'|'def
  925.     SAY pen6' |'def'   ['pen3'#'def'] toggle colors    'pen6'|'def
  926.     SAY pen6' |'def'   ['pen3'$'def'] toggle menu(s)   'pen6'|'def
  927.     SAY pen6' |'def'   ['pen3'&'def'] user profiles    'pen6'|'def
  928.     SAY pen6' |'def'   ['pen3'Z'def'] bbs statistics   'pen6'|'def
  929.     SAY pen6' |'def'   ['pen3','def'] hourly stats     'pen6'|'def
  930.     SAY pen6' |'def'   ['pen3'G'def']oodbye (hangup)   'pen6'|'def
  931.     SAY pen6' |'def'   ['pen3'F'def']iles menu         'pen6'|'def
  932.     SAY pen6' |'def'   ['pen3'M'def']essages menu      'pen6'|'def
  933.     SAY pen6' |________________________|'def
  934.   END
  935. ELSE IF menu='ALL' THEN
  936.   DO
  937.     SAY pen6'     __________________________________________________________'def
  938.     SAY pen6'  __/   'pen3'Main Menu            File Menu          Message Menu 'pen6'  \__'def
  939.     SAY pen6' |                                                                |'def
  940.     SAY pen6' |'def' ['pen3'H'def']elp               ['pen3'A'def']lphabetical list  ['pen3'P'def']ost messages      'pen6'|'def
  941.     SAY pen6' |'def' ['pen3'I'def']nformation        ['pen3'B'def']rowse filenotes   ['pen3'R'def']ead messages      'pen6'|'def
  942.     SAY pen6' |'def' ['pen3'Z'def'] bbs statiZtics   ['pen3'L'def']ist by Library    ['pen3'E'def']mail (private)    'pen6'|'def
  943.     SAY pen6' |'def' ['pen3'Y'def']our user data     ['pen3'N'def']ew files          ['pen3'C'def']omment to SYSOP   'pen6'|'def
  944.     SAY pen6' |'def' ['pen3'O'def']ther users info   ['pen3'F'def']ilelist archiver  ['pen3'!'def'] YELL for SYSOP   'pen6'|'def
  945.     SAY pen6' |'def' ['pen3'J'def']ump to doorways   ['pen3'+'def'] Extra Devices    ['pen3'X'def']pert (no menus)   'pen6'|'def
  946.     SAY pen6' |'def' ['pen3'S'def']earch menu        ['pen3'D'def']ownload           ['pen3'$'def'] toggle menu(s)   'pen6'|'def
  947.     SAY pen6' |'def' ['pen3'&'def'] user profiles    ['pen3'U'def']pload             ['pen3'#'def'] toggle colors    'pen6'|'def
  948.     SAY pen6' |'def' ['pen3'V'def']iew user log      ['pen3'T'def']ransfer protocol  ['pen3','def'] hourly stats     'pen6'|'def
  949.     SAY pen6' |'def' ['pen3'G'def']oodbye (logoff)   ['pen3'QUICK'def'] options      ['pen3'FL'def'] Friends List    'pen6'|'def
  950.     IF(level>sysoplevel) THEN DO
  951.     SAY pen6' |'def' ['pen3'K'def']ill a user        ['pen3'%'def'] edit filenote    ['pen3'='def'] level report     'pen6'|'def
  952.     SAY pen6' |'def' ['pen3'^'def'] view BBS logs    ['pen3'('def'] file report      ['pen3';'def'] change username  'pen6'|'def;END
  953.     IF(level=99) THEN
  954.     SAY pen6' |'def' ['pen3'~'def'] online editor    ['pen3'@'def'] dos shell        ['pen3')'def'] email report     'pen6'|'def
  955.     SAY pen6' |________________________________________________________________|'def
  956.   END
  957. SAY
  958. RETURN
  959.  
  960.  
  961. help:
  962. ARG helppath .
  963. SAY
  964. SAY 'For more detailed help, use ['pen3'I'def']nformation commmand to read BBBBS.COMMANDS.'
  965. IF helppath='MAIN' THEN
  966.   SAY 'Commands available from the' pen3||menu||def 'menu:'
  967. frontend=bbspath'BBS_HELP/'helppath
  968. backend='.USER'
  969. IF level=0 THEN backend='.NEW'
  970. ELSE IF level=99 THEN backend='.SUPER'
  971. ELSE IF level>sysoplevel THEN backend='.SYSOP'
  972. CALL showtext(frontend||backend 1)
  973. RETURN
  974.  
  975.  
  976. waiting:
  977. IF waitchar='Q' THEN
  978.   DO
  979.     waitchar=''
  980.     RETURN
  981.   END
  982. waitchar=''
  983. IF nonstop=1 THEN RETURN
  984. OPTIONS PROMPT pen3'                       RETURN=Continue  'def
  985. PULL waitchar
  986. CALL cleanline(1)
  987. RETURN
  988.  
  989.  
  990. waiting2:
  991. IF nonstop=1 THEN RETURN 0
  992. waitchar=getinput(1 1 pen3'   Q=Quit   N=Non-Stop   RETURN=Continue  'def)
  993. IF waitchar='N' THEN
  994.   DO
  995.     nonstop=1
  996.     SAY pen3'To EXIT non-stop scrolling of text, press CTRL-E        'def
  997.     SAY
  998.     CALL DELAY(99)
  999.     waitchar=''
  1000.   END
  1001. CALL cleanline(1)
  1002. IF waitchar='Q' THEN RETURN 1
  1003. RETURN 0
  1004.  
  1005.  
  1006. busywait:
  1007. ARG bii bi bt 
  1008. IF bbsprefs.21=0 THEN RETURN
  1009. IF bi<1 THEN
  1010.   DO
  1011.     CALL WRITECH(STDOUT,'080808'x)
  1012.     IF ni<1 & i>999998 & wi>999998 THEN SAY
  1013.     RETURN
  1014.   END
  1015. IF bi=1 THEN CALL WRITECH(STDOUT,'   ')
  1016. IF bi//(bii%2)~=0 THEN RETURN
  1017. b=bi//bii
  1018. IF b=0 | b=bii%2 THEN
  1019.   DO
  1020.     tp=RIGHT((bi*100)%bt,2)'%'
  1021.     CALL WRITECH(STDOUT,'080808'x||tp)
  1022.   END
  1023. RETURN
  1024.  
  1025.  
  1026. cleanline:
  1027. ARG lflag .
  1028. IF nonstop=0 & clr~='' THEN
  1029.   DO
  1030.     SAY clr
  1031.     RETURN
  1032.   END
  1033. cline=lineup||LEFT(' ',77)
  1034. IF lflag=1 THEN cline=cline||lineup
  1035. SAY cline
  1036. RETURN
  1037.  
  1038.  
  1039. getinput:
  1040. PARSE ARG upflag' 'oneflag' 'pline
  1041. OPTIONS PROMPT pline
  1042. PARSE PULL inarg
  1043. inarg=STRIP(inarg)
  1044. IF upflag THEN inarg=UPPER(inarg)
  1045. IF oneflag THEN inarg=LEFT(inarg,1)
  1046. RETURN inarg
  1047.  
  1048.  
  1049. docity:
  1050. PARSE ARG citi
  1051. citi=TRANSLATE(citi,'          ','+-.,*/()<>')
  1052. DO i=WORDS(citi) TO 1 BY -1
  1053.   IF DATATYPE(WORD(citi,i),'N') THEN citi=STRIP(DELWORD(citi,i,1))
  1054.   IF UPPER(WORD(citi,i))='USA' THEN citi=STRIP(DELWORD(citi,i,1))
  1055. END
  1056. citi=SPACE(citi,1)
  1057. RETURN STRIP(citi)
  1058.  
  1059.  
  1060. setdir:
  1061. PARSE ARG tempdir
  1062. CALL PRAGMA('D',STRIP(tempdir))
  1063. directory=PRAGMA('D')
  1064. slash=LASTPOS('/',directory)
  1065. IF slash=0 THEN slash=LASTPOS(':',directory)
  1066. plaindir=directory
  1067. IF slash>0 THEN plaindir=SUBSTR(plaindir,slash+1)
  1068. RETURN
  1069.  
  1070.  
  1071. config:
  1072. arg='s:CONFIG.BBS'
  1073. IF ~EXISTS(arg) THEN arg='BBS:BBS_TEXT/CONFIG.BBS'
  1074. IF readlines(arg 1) THEN
  1075.   DO
  1076.     SAY 's:CONFIG.BBS and BBS:BBS_TEXT/CONFIG.BBS are both missing!'
  1077.     SIGNAL DONE2
  1078.   END
  1079. compos=POS('/*',lynes.1)
  1080. IF compos>0 THEN lynes.1=LEFT(lynes.1,compos-1)
  1081. bbsname=STRIP(lynes.1)
  1082. CALL SETCLIP('BBS_bbsname',bbsname)
  1083. sysop=WORD(lynes.2,1)
  1084. compos=POS('/*',lynes.3)
  1085. IF compos>0 THEN lynes.3=LEFT(lynes.3,compos-1)
  1086. exclusion=STRIP(lynes.3)
  1087. bbsdevice=WORD(lynes.4,1)
  1088. sysoplevel=WORD(lynes.5,1)
  1089. bbspath=WORD(lynes.6,1)
  1090. IF ~EXISTS(bbspath) THEN
  1091.   DO
  1092.     SAY bbspath 'does not exist!'
  1093.     SIGNAL DONE2
  1094.   END
  1095. testchar=RIGHT(bbspath,1)
  1096. IF testchar~='/' & testchar~=':' THEN bbspath=bbspath'/'
  1097. CALL SETCLIP('BBS_path',bbspath)
  1098. msgpath=WORD(lynes.7,1)
  1099. IF ~EXISTS(msgpath) THEN
  1100.   DO
  1101.     SAY msgpath 'does not exist!'
  1102.     SIGNAL DONE2
  1103.   END
  1104. testchar=RIGHT(msgpath,1)
  1105. IF testchar~='/' & testchar~=':' THEN msgpath=msgpath'/'
  1106. CALL SETCLIP('BBS_msgpath',msgpath)
  1107. msgpath=msgpath'MSG'
  1108. libpath=WORD(lynes.8,1)
  1109. IF ~EXISTS(libpath) THEN
  1110.   DO
  1111.     SAY libpath 'does not exist!'
  1112.     SIGNAL DONE2
  1113.   END
  1114. testchar=RIGHT(libpath,1)
  1115. IF testchar~='/' & testchar~=':' THEN libpath=libpath'/'
  1116. CALL SETCLIP('BBS_libpath',libpath)
  1117. extdevs=''
  1118. DO i=1 TO WORDS(lynes.10)
  1119.   test=WORD(lynes.10,i)
  1120.   IF POS(':',test)=0 THEN ITERATE i
  1121.   IF LEFT(test,2)='/*' THEN LEAVE i
  1122.   extdevs=STRIP(extdevs test)
  1123. END
  1124. SYSTEM_MSG_LIMIT=WORD(lynes.11,1)
  1125. SYSTEM_SPACE_LIMIT=WORD(lynes.12,1)
  1126. maxidle=WORD(lynes.13,1)
  1127. maxbps=WORD(lynes.15,1)
  1128. IF ~DATATYPE(maxbps,'W') THEN maxbps=2400
  1129. CALL SETCLIP('BBS_baud',maxbps)
  1130. DO i=16 TO 41
  1131.   j=i-15
  1132.   bbsprefs.j=STRIP(WORD(lynes.i,1))
  1133. END
  1134. spellpath=WORD(lynes.9,1)
  1135. IF bbsprefs.5 & ~EXISTS(spellpath) THEN
  1136.   DO
  1137.     SAY spellpath 'does not exist!'
  1138.     bbsprefs.5=0
  1139.   END
  1140. IF bbsprefs.10 THEN scratch=bbspath'Scratch'
  1141. ELSE scratch='RAM:Scratch'
  1142. CALL MAKEDIR(scratch)
  1143. IF ~DATATYPE(bbsprefs.16,'W') THEN bbsprefs.16=3
  1144. extension=WORD(lynes.32,1)
  1145. arccom=lynes.33
  1146. compos=POS('/*',lynes.33)
  1147. IF compos>0 THEN lynes.33=LEFT(lynes.33,compos-1)
  1148. arccom=STRIP(lynes.33)
  1149. IF LEFT(extension,1)~='.' THEN
  1150.   DO
  1151.     extension='.lzh'
  1152.     arccom='lharc -m m'
  1153.   END
  1154. real=0
  1155. IF WORD(lynes.43,1)=1 THEN real=1
  1156. RETURN
  1157.  
  1158.  
  1159. readlogs:
  1160. t=getinput(1 1 'Read [D]aily, [N]umbers, or [Q]uick log? (dnq) > ')
  1161. IF t='' THEN RETURN
  1162. IF t='D' THEN
  1163.   DO
  1164.     arg=getinput(1 0 '['pen3'RETURN'def']=TODAY, or enter Log Date ('pen3||DATE('S')||def') > ')
  1165.     IF arg='' THEN arg=DATE('S')
  1166.     arg=bbspath'Logs/log.'arg
  1167.   END
  1168. ELSE IF t='N' THEN arg=bbspath'logs/QUICK.log'
  1169. ELSE IF t='Q' THEN arg=bbspath'logs/Numbers.log'
  1170. ELSE RETURN
  1171. CALL showtext(arg 1)
  1172. RETURN
  1173.  
  1174.  
  1175. loadcourtesy:
  1176. IF courtesyflag=0 & courtesy='' & EXISTS(bbspath'Lists/Courtesy') THEN
  1177.   DO
  1178.     IF readopen(bbspath'Lists/Courtesy') THEN
  1179.       DO
  1180.         SAY 'Checking Courtesy List...'
  1181.         DO i=1
  1182.           line=READLN(f)
  1183.           IF EOF(f) THEN BREAK
  1184.           courtesy=courtesy UPPER(line)
  1185.         END
  1186.         CALL CLOSE(f)
  1187.         MSG ''
  1188.         MSG pen3'Courtesy List:'def
  1189.         MSG courtesy
  1190.       END
  1191.   END
  1192. RETURN
  1193.  
  1194.  
  1195. fileheader:
  1196. SAY 'Filename          Bytes File# Library         KeyWords'
  1197. SAY pen3||LEFT('=',77,'=')||def
  1198. RETURN
  1199.  
  1200.  
  1201. showalpha:
  1202. libtext=0
  1203. IF DATATYPE(arg,'W') THEN
  1204.   DO
  1205.     dirnum=arg
  1206.     arg=''
  1207.     test='Y'
  1208.     IF chdir2()>0 THEN
  1209.       DO
  1210.         libtext=1
  1211.         RETURN
  1212.       END
  1213.   END
  1214. ELSE
  1215.   DO
  1216.     test=getinput(1 1 'Show one library only? (Ny) > ')
  1217.     IF test='Y' THEN
  1218.       DO
  1219.         IF chdir()>0 THEN
  1220.           DO
  1221.             libtext=1
  1222.             RETURN
  1223.           END
  1224.       END
  1225.   END
  1226.  
  1227. showalpha2:
  1228. libtext=1
  1229. IF test='Y' THEN
  1230.   DO
  1231.     lfile=libpath||plaindir'/.'STRIP(LEFT(plaindir,15))
  1232.     IF EXISTS(lfile) THEN
  1233.       DO
  1234.         CALL showtext(lfile 1)
  1235.         nonstop=0
  1236.         RETURN
  1237.       END
  1238.     filecount=WORDS(SHOWDIR(bbspath'FileNotes/'plaindir))
  1239.   END
  1240. ELSE filecount=files.0
  1241. SAY '  'filecount 'files.'
  1242. CALL fileheader()
  1243. count=0
  1244. DO wi=1 TO alpha.0
  1245.   CALL busywait(60 wi alpha.0)
  1246.   IF test='Y' THEN
  1247.     DO
  1248.       IF count>=filecount THEN LEAVE wi
  1249.       IF UPPER(LEFT(plaindir,12))~=UPPER(LEFT(WORD(alpha.wi,5),12)) THEN
  1250.         ITERATE wi
  1251.     END
  1252.   jj=WORD(alpha.wi,4)
  1253.   IF jj>level | FIND(data.21,UPPER(dirs.jj))>0 THEN
  1254.     ITERATE wi
  1255.   CALL busywait(4 0)
  1256.   SAY LEFT(alpha.wi,76)
  1257.   count=count+1
  1258.   IF (count+2)//linesperpage=0 & wi<alpha.0 THEN
  1259.     IF waiting2() THEN
  1260.       DO
  1261.         CALL busywait(4 1)
  1262.         LEAVE wi
  1263.       END
  1264.   CALL busywait(4 1)
  1265. END
  1266. CALL busywait(4 0)
  1267. nonstop=0
  1268. IF waitchar~='Q' THEN CALL waiting()
  1269. RETURN
  1270.  
  1271.  
  1272. otheruser:
  1273. SAY lm
  1274. CALL bbsOther.rexx(3000 name sysoplevel real bbspath bbsname)
  1275. RETURN
  1276.  
  1277.  
  1278. changename:
  1279. ARG cname
  1280. IF level<=sysoplevel THEN RETURN
  1281. IF cname='' THEN cname=getinput(1 0 'Current Username (include underscore): ')
  1282. IF readlines(bbspath'Users/'cname 1)>0 THEN RETURN
  1283. IF WORD(lynes.20,1)>level THEN RETURN
  1284. CALL SETCLIP('BBS_oldname',cname)
  1285. CALL ChangeUserName.rexx()
  1286. ncname=GETCLIP('BBS_newname')
  1287. IF name=cname THEN name=ncname
  1288. CALL DELETE(bbspath'Lists/USERS')
  1289. sortuserflag=1
  1290. CALL SETCLIP('BBS_oldname')
  1291. CALL SETCLIP('BBS_newname')
  1292. RETURN ncname
  1293.  
  1294.  
  1295. levelreport:
  1296. SAY lm
  1297. CALL bbsNewUsers.rexx(name level 1 3000)
  1298. RETURN
  1299.  
  1300.  
  1301. filereport:
  1302. SAY 'Searching for mismatches between files and filenotes...'
  1303. DO i=1 TO sysoplevel+1
  1304.   IF dirs.i='' THEN ITERATE
  1305.   SAY dirs.i'                               'lineup
  1306.   rfiles=SHOWDIR(libpath||dirs.i)
  1307.   rnotes=SHOWDIR(bbspath'FileNotes/'dirs.i)
  1308.   IF WORDS(rfiles)~=WORDS(rnotes) THEN
  1309.     DO
  1310.       line='Compare files & filenotes in'pen3 dirs.i||def'. '
  1311.       DO j=1 TO WORDS(rfiles)
  1312.         IF FIND(UPPER(rnotes),UPPER(WORD(rfiles,j)))=0 THEN
  1313.           line=line WORD(rfiles,j)
  1314.       END
  1315.       SAY line
  1316.     END
  1317. END
  1318. SAY '07'x
  1319. CALL waiting()
  1320. RETURN
  1321.  
  1322.  
  1323. mailreport:
  1324. SAY 'Checking ALL pending Email...'
  1325. SAY pen3' - Use CTRL-E to Exit -'def
  1326. SAY
  1327. mailrep=SHOWDIR(bbspath'Email','D')
  1328. mailfil=SHOWDIR(bbspath'EmailFiles','D')
  1329. lastemail=WORD(data.17,3)
  1330. IF ~DATATYPE(lastemail,'W') THEN lastemail=0
  1331. IF lastemail=countcheck('LastMail' 0) THEN
  1332.   DO
  1333.     DROP mailrep. mailfil.
  1334.     RETURN
  1335.   END
  1336. mailynes.=''
  1337. mk=0
  1338. DO mi=1 TO WORDS(mailrep)
  1339.   muser=WORD(mailrep,mi)
  1340.   IF muser=sysop | muser=name THEN ITERATE mi
  1341.   mlist=SHOWDIR(bbspath'Email/'muser)
  1342.   IF WORDS(mlist)>0 THEN SAY lineup||RIGHT(muser,40)
  1343.   DO mj=1 TO WORDS(mlist)
  1344.     fuser=WORD(mlist,mj)
  1345.     IF POS(sysop,fuser)>0 THEN ITERATE mj
  1346.     IF logonflag=0 THEN
  1347.       DO
  1348.         mk=mk+1
  1349.         mailynes.mk=pen3||LEFT(muser,20) 'from'def LEFT(fuser,20) DATE(,WORD(STATEF(bbspath'Email/'muser'/'fuser),5),'I')
  1350.       END
  1351.     IF POS(sysop,fuser)=0 & POS(name,fuser)=0 THEN
  1352.       DO
  1353.         testnum=RIGHT(fuser,LENGTH(fuser)-LASTPOS('.',fuser))
  1354.         IF testnum>emailnum THEN emailnum=testnum
  1355.         IF testnum>lastemail THEN
  1356.           DO
  1357.             CALL showtext(bbspath'Email/'muser'/'fuser 1)
  1358.             SAY
  1359.             SAY
  1360.             IF waitchar='Q' THEN LEAVE mi
  1361.           END
  1362.       END
  1363.   END
  1364.   IF logonflag=0 & FIND(mailfil,muser)>0 THEN
  1365.     DO
  1366.       efilelist=SHOWDIR(bbspath'EmailFiles/'muser)
  1367.       IF WORDS(efilelist)>0 THEN
  1368.         DO
  1369.           mk=mk+1
  1370.           mailynes.mk=pen3||LEFT(muser,20) 'emailfiles'def efilelist
  1371.         END
  1372.     END
  1373. END
  1374. data.17=WORD(data.17,1) WORD(data.17,2) countcheck('LastMail' 0)
  1375. IF mk>0 THEN
  1376.   DO
  1377.     lynes.0=mk
  1378.     DO mi=1 TO mk
  1379.       lynes.mi=mailynes.mi
  1380.     END
  1381.     CALL seelines(1)
  1382.     nonstop=0
  1383.     CALL waiting()
  1384.   END
  1385. ELSE SAY 'No unseen Email pending.'
  1386. DROP mailrep. mailfil. mailynes. mlist
  1387. RETURN
  1388.  
  1389.  
  1390. jump2rexx:
  1391. arg=bbspath'BBS_TEXT/REXXDOORS'
  1392. IF EXISTS(arg) THEN CALL showtext(arg 0)
  1393. SAY lm
  1394. CALL bbsDoors.rexx(3000 name password)
  1395. RETURN
  1396.  
  1397.  
  1398. sortlibraries:
  1399. SAY 'Sorting Libraries...'
  1400. count=0
  1401. sdirs.=''
  1402. DO i=1 TO level
  1403.   IF dirs.i='' THEN ITERATE i
  1404.   count=count+1
  1405.   sdirs.count=dirs.i i
  1406. END
  1407. sdirs.0=count
  1408. IF count>0 THEN CALL QSort(1,count,sdirs)
  1409. count=0
  1410. libs.=''
  1411. DO i=1 TO sdirs.0
  1412.   tempnum=WORD(sdirs.i,2)
  1413.   tempdir=WORD(sdirs.i,1)
  1414.   IF FIND(data.21,UPPER(tempdir))=0 THEN
  1415.     DO
  1416.       string=' '
  1417.       IF tempnum<10 THEN string=string' '
  1418.       string=string || tempnum'. 'LEFT(tempdir,14)
  1419.       count=count+1
  1420.       libs.count=string
  1421.     END
  1422. END
  1423. libs.0=count%4
  1424. IF (count//4)>0 THEN libs.0=libs.0+1
  1425. DO i=1 TO libs.0
  1426.   DO j=1 TO 3
  1427.     k=i+j*libs.0
  1428.     IF k<=count THEN libs.i=libs.i||libs.k
  1429.   END
  1430. END
  1431. RETURN
  1432.  
  1433.  
  1434. sortconferences:
  1435. SAY 'Sorting Conferences...'
  1436. count=0
  1437. smsg.=''
  1438. DO i=1 TO level
  1439.   IF msg.i='' THEN ITERATE i
  1440.   count=count+1
  1441.   smsg.count=msg.i i
  1442. END
  1443. smsg.0=count
  1444. IF count>0 THEN CALL QSort(1,count,smsg)
  1445. count=0
  1446. msgs.=''
  1447. DO i=1 TO smsg.0
  1448.   tempnum=WORD(smsg.i,2)
  1449.   tempdir=WORD(smsg.i,1)
  1450.   IF FIND(data.21,tempnum)=0 THEN
  1451.     DO
  1452.       string=' '
  1453.       IF tempnum<10 THEN string=string' '
  1454.       string=string || tempnum'.'
  1455.       IF WORD(data.22,tempnum)='' | WORD(data.22,tempnum)>=0 THEN
  1456.         string=string LEFT(tempdir,20)
  1457.       ELSE string=string pen2'-OFF-'def LEFT(tempdir,14)
  1458.       count=count+1
  1459.       msgs.count=string
  1460.     END
  1461. END
  1462. msgs.0=count%3
  1463. IF (count//3)>0 THEN msgs.0=msgs.0+1
  1464. DO i=1 TO msgs.0
  1465.   DO j=1 TO 2
  1466.     k=i+j*msgs.0
  1467.     IF k<=count THEN msgs.i=msgs.i msgs.k
  1468.   END
  1469. END
  1470. RETURN
  1471.  
  1472.  
  1473. readmessages:
  1474. CALL SETCLIP('BBSMSG_ARG',colorflag arg)
  1475. CALL bbsMsg.rexx(6000 name password)
  1476. SAY lm
  1477. CALL loaddata()
  1478. CALL checkemail()
  1479. RETURN
  1480.  
  1481.  
  1482. showmarked:
  1483. ARG ff .
  1484. IF WORDS(data.24)<1 THEN RETURN
  1485. fline='These unread conference messages have been ['pen3'M'pen6']arked as addressed to you:'
  1486. IF ff THEN
  1487.   DO
  1488.     SAY
  1489.     SAY pen6||fline||def
  1490.   END
  1491. tempkk=data.24
  1492. DO i=1 TO WORDS(tempkk)
  1493.   tempk=WORD(tempkk,i)
  1494.   PARSE VAR tempk kdir'/'kmsg
  1495.   line=RIGHT(kmsg,6) 'in the'pen3 msg.kdir def'conference'
  1496.   IF EXISTS(msgpath||tempk) THEN
  1497.     DO
  1498.       IF ff THEN SAY line'.'
  1499.       ELSE fline=fline'0A'x||line'.'
  1500.     END
  1501.   ELSE
  1502.     DO
  1503.       line=line 'is missing.'
  1504.       IF ff THEN SAY line
  1505.       ELSE fline=fline'0A'x||line
  1506.       mkw=FIND(data.24,tempk)
  1507.       data.24=STRIP(DELWORD(data.24,mkw,1))
  1508.       CALL savedata(0)
  1509.     END
  1510. END
  1511. IF ff THEN
  1512.   DO
  1513.     CALL waiting()
  1514.     SAY
  1515.   END
  1516. ELSE
  1517.   DO
  1518.     IF writeopen(bbspath'EmailFiles/'name'/Marked')=0 THEN RETURN
  1519.     CALL WRITELN(f,fline)
  1520.     CALL CLOSE(f)
  1521.   END
  1522. RETURN
  1523.  
  1524.  
  1525. readmail:
  1526. ARG fromenu .
  1527. replysubj=''
  1528. IF fromenu THEN SAY lm
  1529. ELSE arg=''
  1530. CALL SETCLIP('BBSMAIL_ARG',fromenu arg)
  1531. CALL bbsMail.rexx(3000 name password)
  1532. CALL checkemail()
  1533. RETURN
  1534.  
  1535.  
  1536. checkemail:
  1537. x=GETCLIP('LOCAL_email')
  1538. CALL SETCLIP('LOCAL_email')
  1539. If DATATYPE(x,'W') THEN
  1540.   IF emailonline>-1 THEN emailonline=emailonline+x
  1541. RETURN
  1542.  
  1543.  
  1544. countcheck:
  1545. PARSE ARG fname' 'cknum .
  1546. fname=bbspath'Numbers/'fname
  1547. IF ~EXISTS(fname) THEN
  1548.   DO
  1549.     IF cknum=0 THEN RETURN 0
  1550.     IF ~writeopen(fname) THEN RETURN 0
  1551.     CALL WRITELN(f,cknum)
  1552.     CALL CLOSE(f)
  1553.     RETURN cknum
  1554.   END
  1555. IF ~readopen(fname) THEN
  1556.   DO
  1557.     CALL DELAY(99)
  1558.     IF ~readopen(fname) THEN RETURN cknum
  1559.   END
  1560. retval=STRIP(READLN(f))
  1561. CALL CLOSE(f)
  1562. IF ~DATATYPE(retval,'W') THEN retval=0
  1563. IF ~DATATYPE(cknum,'W') THEN cknum=0
  1564. IF retval<cknum THEN
  1565.   DO
  1566.     IF writeopen(fname) THEN
  1567.       DO
  1568.         CALL WRITELN(f,cknum)
  1569.         CALL CLOSE(f)
  1570.         RETURN cknum
  1571.       END
  1572.   END
  1573. RETURN retval
  1574.  
  1575.  
  1576. sysEd:
  1577. IF level<99 THEN RETURN
  1578. arg=getinput(0 0 'Textfile To Edit: ')
  1579. IF arg='' THEN RETURN
  1580. SAY lm
  1581. CALL bbsEd.rexx(1 arg name)
  1582. CALL checkfilechanges()
  1583. RETURN
  1584.  
  1585.  
  1586. editor:
  1587. PARSE ARG edarg
  1588. SAY lm
  1589. IF bbsWrite.rexx(edarg)=0 THEN RETURN
  1590. IF WORD(edarg,3)='MAIL' THEN
  1591.   DO
  1592.     IF emailonline>=0 THEN emailonline=emailonline+1
  1593.   END
  1594. ELSE
  1595.   DO
  1596.     grand=grand+1
  1597.     IF ~DATATYPE(msg.msgdir.0,'W') THEN msg.msgdir.0=1
  1598.     ELSE msg.msgdir.0=msg.msgdir.0+1
  1599.   END
  1600. CALL loaddata()
  1601. RETURN
  1602.  
  1603.  
  1604. edinfo:
  1605. PARSE ARG t1,t2,t3
  1606. IF level<sysoplevel THEN RETURN 0
  1607. IF getinput(1 1 'Edit the'pen3 t2 def||t3 'info file? (Ny) > ')='Y' THEN
  1608.   DO
  1609.     IF ~EXISTS(t) THEN
  1610.       DO
  1611.         IF writeopen(t1)~=0 THEN
  1612.           DO
  1613.             CALL WRITELN(f,TRIM(CENTER('***'pen3 t2 def||t3 '***',75)))
  1614.             CALL WRITELN(f,LEFT('',75,'='))
  1615.             CALL CLOSE(f)
  1616.             CALL DELAY(28)
  1617.           END
  1618.       END
  1619.     CALL bbsEd.rexx(1 t1 name)
  1620.     arg=''
  1621.     RETURN 1
  1622.   END
  1623. RETURN 0
  1624.  
  1625.  
  1626. shell:
  1627. SAY
  1628. olddir=PRAGMA('D')
  1629. DO WHILE(UPPER(opt)~='EXIT')
  1630.   SAY bak2||TIME('C')||def PRAGMA('D')
  1631.   OPTIONS PROMPT pen3'Type EXIT to quit AmigaDOS> 'def
  1632.   PARSE PULL opt' 'arg
  1633.   IF(UPPER(opt)='CD') THEN CALL setdir(arg)
  1634.   ELSE IF EXISTS(opt)~=0 THEN
  1635.     DO
  1636.       IF LEFT(STATEF(opt),3)='DIR' THEN CALL setdir(opt)
  1637.     END
  1638.   ELSE IF opt~='' & UPPER(opt)~='EXIT' THEN
  1639.     ADDRESS COMMAND opt '<* >*' arg
  1640. END
  1641. CALL PRAGMA('D',olddir)
  1642. RETURN
  1643.  
  1644.  
  1645. bbsspace:
  1646. ARG tabspace .
  1647. ADDRESS COMMAND 'C:info >'scratch'/locinfout' bbsdevice
  1648. ok=OPEN(f,scratch'/locinfout','R')
  1649. IF ok=0 THEN RETURN 20
  1650. line=READLN(f)
  1651. line=READLN(f)
  1652. line=READLN(f)
  1653. line=READLN(f)
  1654. CALL CLOSE(f)
  1655. IF tabspace<14 THEN SAY 
  1656. bbsk=WORD(line,4)
  1657. IF ~DATATYPE(bbsk,'N') THEN
  1658.   DO
  1659.     line=bbsdevice 'is not an info compatible device!'
  1660.     SAY pen3||line||def
  1661.     bbsk=0
  1662.     RETURN
  1663.   END
  1664. bbsk=bbsk*512-SYSTEM_SPACE_LIMIT
  1665. IF bbsk<1 THEN bbsk=0
  1666. SAY RIGHT(comma(bbsk),tabspace) 'bytes available for uploads.'
  1667. RETURN
  1668.  
  1669.  
  1670. comma: PROCEDURE
  1671. ARG num .
  1672. t=''
  1673. x=POS('.',num)
  1674. IF x>0 THEN t=SUBSTR(num,x)
  1675. num=num%1
  1676. dgt=LENGTH(num)
  1677. numtext=''
  1678. IF dgt>3 THEN numtext=','RIGHT(num,3)
  1679. IF dgt>6 THEN numtext=','LEFT(RIGHT(num,6),3)||numtext
  1680. IF dgt>9 THEN numtext=','LEFT(RIGHT(num,9),3)||numtext
  1681. IF dgt>12 THEN
  1682.   DO
  1683.     numtext=','LEFT(RIGHT(num,12),3)||numtext
  1684.     numtext=LEFT(num,dgt-12)||numtext
  1685.   END
  1686. ELSE IF dgt>9 THEN numtext=LEFT(num,dgt-9)||numtext
  1687. ELSE IF dgt>6 THEN numtext=LEFT(num,dgt-6)||numtext
  1688. ELSE IF dgt>3 THEN numtext=LEFT(num,dgt-3)||numtext
  1689. ELSE numtext=num
  1690. RETURN numtext||t
  1691.  
  1692.  
  1693. is_here:
  1694. ARG newname 
  1695. CALL WRITECH(STDOUT,'Checking filelist')
  1696. DO wi=1 TO 99
  1697.   IF wi//3=0 THEN CALL WRITECH(STDOUT,'.')
  1698.   IF dirs.wi='' THEN ITERATE wi
  1699.   IF ~EXISTS(bbspath'FileNotes/'dirs.wi'/'newname) THEN ITERATE wi
  1700.   line=pen3'*** File' newname 'already exists here'
  1701.   IF wi<=level THEN line=line 'in the' dirs.wi 'library'
  1702.   line=line'.'def
  1703.   SAY line
  1704.   SAY 'Original uploader should ['pen3'K'def']ill the file before uploading the replacement.'
  1705.   CALL waiting()
  1706.   RETURN 1
  1707. END
  1708. CALL cleanline(1)
  1709. RETURN 0
  1710.  
  1711.  
  1712. uload:
  1713. ARG frommenu
  1714. CALL bbsspace(12)
  1715. SAY
  1716. IF bbsk<1 THEN
  1717.   DO
  1718.     SAY pen3'Upload area is full!'def
  1719.     RETURN 1
  1720.   END
  1721. IF ~SHOW('P','BUILDALPHA') THEN CALL SETCLIP('BBS_UPLOAD')
  1722. IF frommenu & GETCLIP('BBS_UPLOAD')~='' THEN
  1723.   DO
  1724.     SAY pen3'Uploading is temporarily suspended while the filelists are rebuilding.'def
  1725.     CALL waiting()
  1726.     RETURN 1
  1727.   END
  1728. IF arg='' THEN
  1729.   DO
  1730.     frompath=GETCLIP('BBS_frompath')
  1731.     IF frompath='' THEN frompath='RAM:'
  1732.     fdir=''
  1733.     DO loop=1
  1734.       fromfile=GetFile(150,36,frompath,'',' Select File to Upload ')
  1735.       IF fromfile='' THEN RETURN 1
  1736.       IF EXISTS(fromfile) THEN LEAVE loop
  1737.       SAY
  1738.       SAY fromfile 'does not exist!'
  1739.     END
  1740.     x=LASTPOS('/',fromfile)
  1741.     IF x=0 THEN x=POS(':',fromfile)
  1742.     IF x>0 THEN
  1743.       DO
  1744.         arg=SUBSTR(fromfile,x+1)
  1745.         fdir=LEFT(fromfile,x)
  1746.         IF RIGHT(fdir,1)='/' THEN fdir=LEFT(fdir,x-1)
  1747.         CALL SETCLIP('BBS_frompath',fdir)
  1748.       END
  1749.     ELSE arg=fromfile
  1750.   END
  1751. ELSE fromfile=PRAGMA('D')'/'arg
  1752. arg=COMPRESS(arg,' :/,;|#?*()+[]"{}')  /* be sure no illegals here */
  1753. x=LASTPOS('/',fromfile)
  1754. IF x=0 THEN x=LASTPOS(':',fromfile)
  1755. IF x>0 THEN
  1756.   DO
  1757.     IF DATATYPE(SUBSTR(fromfile,x+1),'W') THEN
  1758.       DO
  1759.         SAY 'Whole numbers are not allowed as filenames!'
  1760.         CALL waiting()
  1761.         RETURN 1
  1762.       END
  1763.   END
  1764. tempnum=LENGTH(arg)-16
  1765. DO WHILE tempnum>0 & POS('EMAILFILES',UPPER(PRAGMA('D')))=0
  1766.   temp='          'pen3||arg def'is'pen3 tempnum||def
  1767.   IF tempnum=1 THEN temp=temp 'character'
  1768.   ELSE temp=temp 'characters'
  1769.   temp=temp 'too long for a filename.'
  1770.   SAY temp  
  1771.   arg=getinput(0 0 'Filename: ')
  1772.   arg=cleanstring('0:'arg)
  1773.   arg=COMPRESS(arg,' :/,;|#?*')
  1774.   tempnum=LENGTH(arg)-16
  1775. END
  1776. IF arg='' THEN RETURN 1
  1777. IF frommenu THEN
  1778.   DO
  1779.     IF is_here(arg) THEN RETURN 1
  1780.     IF bbsprefs.6=1 & sysoplevel>level THEN CALL setdir(libpath'Sysops')
  1781.     ELSE
  1782.       DO
  1783.         SAY 'Please select an appropriate library for -' pen3||arg def'-'
  1784.         IF chdir()>0 THEN RETURN
  1785.       END
  1786.   END
  1787. ADDRESS COMMAND 'C:COPY' fromfile PRAGMA('D')'/'arg
  1788. IF TestArc.rexx(PRAGMA('D')'/'arg)>0 THEN
  1789.   DO
  1790.     SAY
  1791.     SAY pen3'***'def arg pen3'failed archive check!'def
  1792.     SAY
  1793.     temp=getinput(1 1 'Do you believe the archive checker made a mistake? (Ny) > ')
  1794.     IF temp~='Y' THEN
  1795.       DO
  1796.         CALL DELETE(arg)
  1797.         SAY
  1798.         RETURN 2
  1799.       END
  1800.   END
  1801. IF POS('EMAILFILES',UPPER(PRAGMA('D')))>0 THEN RETURN 0
  1802. DO ui=sysoplevel+2 TO 100
  1803.   IF UPPER(dirs.ui)=UPPER(plaindir) THEN RETURN 0
  1804. END
  1805. IF frommenu THEN
  1806.   DO
  1807.     DO WHILE editnote(bbspath'FileNotes/'plaindir'/'arg) /* INSIST on a filenote */
  1808.     END
  1809.     CALL DELETE(libpath||plaindir'/.'STRIP(LEFT(plaindir,15)))
  1810.   END
  1811. RETURN 0
  1812.  
  1813.  
  1814. findfiles:
  1815. PARSE ARG ffile .
  1816. IF POS('EMAILFILES',UPPER(PRAGMA('D')))>0 THEN RETURN ffile
  1817. wi=0
  1818. IF DATATYPE(ffile,'W') THEN
  1819.   DO
  1820.     IF WORDS(files.ffile)<2 THEN RETURN 0
  1821.     dirtemp=WORD(files.ffile,1)
  1822.     IF finddirnum(dirtemp)>level | FIND(data.21,UPPER(dirtemp))>0 THEN
  1823.       DO
  1824.         CALL illegal_access()
  1825.         RETURN 0
  1826.       END
  1827.     CALL setdir(libpath||dirtemp)
  1828.   END
  1829. ELSE IF EXISTS(ffile) THEN
  1830.   DO
  1831.     IF EXISTS(bbspath'FileNotes/'plaindir'/'ffile) THEN
  1832.       DO
  1833.         IF readopen(bbspath'FileNotes/'plaindir'/'ffile)~=0 THEN
  1834.           DO
  1835.             line=READLN(f)
  1836.             CALL CLOSE(f)
  1837.             ffile=WORD(line,2)
  1838.           END
  1839.       END
  1840.   END
  1841. ELSE IF EXISTS(bbspath'Information'ffile) THEN
  1842.   RETURN bbspath'Information/'ffile
  1843. ELSE
  1844.   DO
  1845.     nextfilenum=countcheck('LastFile' 0)+1
  1846.     CALL busywait(4 1)
  1847.     DO ni=nextfilenum TO 0 BY -1
  1848.       IF ni<1 THEN
  1849.         DO
  1850.           CALL busywait(4 0)
  1851.           SAY '***' files.0 'filenames scanned,'pen3 ffile def'was not found!'
  1852.           RETURN 0
  1853.         END
  1854.       IF ni>1 THEN CALL busywait(60 ni nextfilenum)
  1855.       argtemp=WORD(files.ni,2)
  1856.       IF UPPER(argtemp)=UPPER(ffile) THEN
  1857.         DO
  1858.           dirtemp=WORD(files.ni,1)
  1859.           jj=files.ni.0
  1860.           IF WORD(alpha.jj,4)>level | FIND(data.21,UPPER(dirtemp))>0 THEN
  1861.             DO
  1862.               CALL busywait(4 0)
  1863.               CALL illegal_access()
  1864.               RETURN 0
  1865.             END
  1866.           ffile=ni
  1867.           CALL setdir(libpath||dirtemp)
  1868.           LEAVE ni
  1869.         END
  1870.     END
  1871.     CALL busywait(4 0)
  1872.   END
  1873. IF wi=999999 THEN RETURN 0
  1874. ftemp=ffile
  1875. IF DATATYPE(ftemp,'W') THEN ftemp=WORD(files.ftemp,2)
  1876. IF ~EXISTS(ftemp) THEN
  1877.   DO
  1878.     finfo=STATEF(bbspath'FileNotes/'plaindir'/'ftemp)
  1879.     IF WORDS(finfo)>7 THEN ftemp=WORD(finfo,8)
  1880.     IF ~EXISTS(ftemp) THEN
  1881.       DO
  1882.         IF finfo='' THEN SAY '***'pen3 PRAGMA('D')'/'ftemp def'was not found!'
  1883.         ELSE
  1884.           DO
  1885.             SAY
  1886.             SAY '***'pen3 plaindir'/'ftemp def'is not currently available online.'
  1887.             SAY 'Please leave email to your sysop'pen3 sysop||def', to receive this file.'
  1888.             SAY
  1889.           END
  1890.         RETURN 0
  1891.       END
  1892.   END
  1893. RETURN ffile
  1894.  
  1895.  
  1896. illegal_access:
  1897. SAY
  1898. SAY '*** You are not authorized to access' ffile'!'
  1899. SAY '*** Send Email to' sysop 'to receive a higher level.'
  1900. SAY
  1901. RETURN
  1902.  
  1903.  
  1904. ext_dload:
  1905. SAY
  1906. arg=bbsExtDL.baud(name level 3000 linesperpage colorflag extdevs)
  1907. IF arg~='' THEN SAY 'Sorry, LOCAL mode cannot download from the Extra Devices.'
  1908. RETURN
  1909.  
  1910.  
  1911. dload:
  1912. arg=STRIP(arg data.25)
  1913. data.25=''
  1914. errorflag=0
  1915. curdir=PRAGMA('D')
  1916. OPTIONS PROMPT 'File numbers (and/or names): '
  1917. IF arg='' THEN PARSE PULL arg  /* no filename given */
  1918. IF arg='' THEN RETURN 0
  1919. IF findfiles(arg)=0 THEN RETURN 0
  1920. arg=TRANSLATE(arg,'     ',':/,;|')
  1921. IF WORDS(arg)>1 THEN arg=WORD(arg,1)
  1922. IF DATATYPE(arg,'W') THEN
  1923.   DO
  1924.     CALL setdir(libpath||WORD(files.arg,1))
  1925.     arg=WORD(files.arg,2)
  1926.   END
  1927. IF arg~='' THEN           /* check for filename */
  1928.   DO dloadloop=1
  1929.     frompath=GETCLIP('BBS_frompath')
  1930.     IF frompath='' THEN frompath=libpath'SysOps/'
  1931.     notename=bbspath'FileNotes/'plaindir'/'arg
  1932.     IF ~EXISTS(arg) THEN
  1933.       DO
  1934.         finfo=STATEF(notename)
  1935.         IF WORDS(finfo)>7 THEN
  1936.           DO
  1937.             temp=plaindir
  1938.             x=lastslash(WORD(finfo,8))
  1939.             arg=WORD(x,1)
  1940.             CALL setdir(WORD(x,2))
  1941.             plaindir=temp
  1942.           END
  1943.       END
  1944.     topath=PRAGMA('D')
  1945.     num=LASTPOS('/',arg)
  1946.     IF num=0 THEN num=LASTPOS(':',arg)
  1947.     IF num>0 THEN
  1948.       DO
  1949.         topath=LEFT(arg,num)
  1950.         arg=SUBSTR(arg,num+1)
  1951.       END
  1952.     IF RIGHT(topath,1)~=':' & RIGHT(topath,1)~='/' THEN topath=topath'/'
  1953.     SAY ' Select Filename to Copy ' topath||arg 'To:'
  1954.     tofile=GetFile(150,36,frompath,arg,' Select Destination Name ')
  1955.     IF tofile='' THEN
  1956.       DO
  1957.         errorflag=1
  1958.         LEAVE dloadloop
  1959.       END
  1960.     ADDRESS COMMAND 'C:Copy' topath||arg tofile
  1961.     CALL SETCLIP('BBS_frompath',WORD(lastslash(tofile),2))
  1962.     IF POS('EMAILFILES',UPPER(PRAGMA('D')))>0 THEN LEAVE dloadloop
  1963.     DO di=sysoplevel+2 TO 100
  1964.       IF UPPER(dirs.di)=UPPER(plaindir) THEN LEAVE dloadloop
  1965.     END
  1966.     IF readlines(notename 1) THEN LEAVE dloadloop
  1967.     dls=WORD(lynes.2,7)
  1968.     IF ~DATATYPE(dls,'W') THEN dls=0
  1969.     lynes.2=STRIP(DELWORD(lynes.2,7,1)) dls+1
  1970.     finfo=STATEF(notename)
  1971.     IF WORDS(finfo)>7 THEN finfo=SUBSTR(finfo,WORDINDEX(finfo,8))
  1972.     ELSE finfo=''
  1973.     CALL DELETE(notename)
  1974.     CALL savelines(notename)
  1975.     CALL DELAY(28)
  1976.     IF finfo~='' THEN ADDRESS COMMAND 'C:FileNote' notename finfo
  1977.     LEAVE dloadloop
  1978.   END
  1979. CALL setdir(curdir)
  1980. IF errorflag THEN SAY pen3'*** Download Failed!'def
  1981. RETURN errorflag
  1982.  
  1983.  
  1984. lastslash:
  1985. PARSE ARG sarg 
  1986. sdir=''
  1987. slash=LASTPOS('/',sarg)
  1988. IF slash>2 THEN sdir=LEFT(sarg,slash-1)
  1989. ELSE
  1990.   DO
  1991.     slash=LASTPOS(':',sarg)
  1992.     IF slash>0 THEN sdir=LEFT(sarg,slash)
  1993.   END
  1994. IF slash>0 THEN sarg=SUBSTR(sarg,slash+1)
  1995. RETURN sarg sdir
  1996.  
  1997.  
  1998. editnote:
  1999. IF arg='' THEN
  2000.   DO
  2001.     PARSE PULL arg .
  2002.     IF arg='' THEN RETURN 0
  2003.   END
  2004. comment=''
  2005. IF ~EXISTS(arg) THEN
  2006.   DO
  2007.     finfo=STATEF(bbspath'FileNotes/'plaindir'/'arg)
  2008.     fromarg=arg
  2009.     fromdir=GETCLIP('BBS_frompath')
  2010.     IF WORDS(finfo)>7 THEN
  2011.       DO
  2012.         temp='Y'
  2013.         fromdir=WORD(finfo,8)
  2014.         fromdir=lastslash(fromdir)
  2015.         fromarg=WORD(fromdir,1)
  2016.         fromdir=WORD(fromdir,2)
  2017.       END
  2018.     ELSE
  2019.       DO
  2020.         IF level<sysoplevel THEN RETURN 0
  2021.         temp=getinput(1 1 'Is this file on an another device? (Nqy)')
  2022.       END
  2023.     IF fromdir='' THEN fromdir='RAM:'
  2024.     IF temp='Y' THEN
  2025.       DO WHILE comment=''
  2026.         comment=GetFile(150,36,fromdir,fromarg,' Select Linked File ')
  2027.         IF comment='' THEN RETURN 0
  2028.         IF ~EXISTS(comment) THEN comment=''
  2029.         ELSE CALL SETCLIP('BBS_frompath',WORD(lastslash(comment),2))
  2030.       END
  2031.     ELSE IF temp~='N' THEN RETURN 0
  2032.   END
  2033. IF comment='' THEN
  2034.   DO
  2035.     arg=findfiles(arg)
  2036.     IF arg=0 THEN RETURN 0
  2037.     IF DATATYPE(arg,'W') THEN arg=WORD(files.arg,2)
  2038.   END
  2039. filedir=plaindir
  2040. slash=LASTPOS('/',arg)
  2041. IF slash=0 THEN slash=LASTPOS(':',arg)
  2042. IF slash>0 THEN
  2043.   DO
  2044.     filedir=LEFT(arg,slash-1)
  2045.     filedir=SUBSTR(filedir,5)
  2046.     arg=SUBSTR(arg,slash+1)
  2047.   END
  2048. ELSE filedir=plaindir
  2049. CALL MAKEDIR(bbspath'FileNotes/'filedir)
  2050. IF ~EXISTS(bbspath'FileNotes/'filedir) THEN
  2051.   DO
  2052.     SAY pen3'*** Failed to open directory!' filedir||def
  2053.     RETURN 0
  2054.   END
  2055. notename=bbspath'FileNotes/'filedir'/'arg
  2056. lynes.=''
  2057. filenum=countcheck('LastFile' 0)
  2058. IF level>sysoplevel THEN firstedit=1
  2059. ELSE firstedit=5
  2060. IF EXISTS(notename) THEN
  2061.   DO
  2062.     IF comment~='' THEN ADDRESS COMMAND 'C:filenote' notename comment
  2063.     CALL bbsEd.rexx(firstedit notename name)
  2064.     CALL checkfilechanges()
  2065.     RETURN 0
  2066.   END
  2067. IF comment='' THEN filedata=STATEF(libpath||filedir'/'arg)
  2068. ELSE filedata=STATEF(comment)
  2069. IF filedata='' THEN
  2070.   DO
  2071.     IF comment='' THEN line=filedir'/'arg
  2072.     ELSE line=comment
  2073.     SAY line 'does not exist!'
  2074.     RETURN 0
  2075.   END
  2076. bytes=WORD(filedata,2)
  2077. filenum=filenum+1
  2078. lynes.0=4
  2079. lynes.1='File: 'LEFT(filenum,5)' KeyWords:'
  2080. lynes.2='Name: 'LEFT(arg,27)' Size: 'bytes' bytes   Downloads: 0'
  2081. lynes.3='From: 'LEFT(name,27)' Date: 'DATE() TIME('C')'  Lib: 'filedir
  2082. lynes.4=LEFT('',74,'=')
  2083. lynes.1=lynes.1 edkeywords(arg filedir)
  2084. diz='RAM:file_id.diz'
  2085. IF EXISTS(diz) THEN CALL readlines(diz 5)
  2086. CALL DELETE(diz)
  2087. CALL seelines(1)
  2088. edtype=''
  2089. CALL writebuffer(scratch'/NoteLOCAL')
  2090. IF savelines(notename) THEN RETURN 0
  2091. IF comment~='' THEN ADDRESS COMMAND 'C:filenote' notename comment
  2092. CALL DELETE(libpath||filedir'/.'STRIP(LEFT(filedir,15)))
  2093. fncom='R'
  2094. DO WHILE fncom='R'
  2095.   CALL seelines(1)
  2096.   nonstop=0
  2097.   line='['pen3'E'def']dit'
  2098.   IF level>sysoplevel THEN line=line '['pen3'K'def']ill'
  2099.   line=line '['pen3'R'def']ead ['pen3'S'def']ave'
  2100.   IF level>sysoplevel THEN line=line '(ekrS) 'def
  2101.   ELSE line=line '(erS) 'def
  2102.   fncom=getinput(1 1 line)
  2103.   IF fncom='K' & level>sysoplevel THEN
  2104.     DO
  2105.       SAY 'Killing FileNote..'
  2106.       CALL DELETE(notename)
  2107.       RETURN 1
  2108.     END
  2109.   ELSE IF fncom='E' THEN
  2110.     DO
  2111.       IF bbsEd.rexx(firstedit notename name)>0 THEN RETURN 0
  2112.       CALL readlines(notename 1)
  2113.       CALL checkfilechanges()
  2114.       fncom='R'
  2115.     END
  2116.   ELSE IF fncom~='R' THEN
  2117.     DO
  2118.       SAY 'Adjusting filelist...'
  2119.       IF filenum<1 THEN filenum=1
  2120.       IF GETCLIP('BBS_level')~='' THEN CALL SETCLIP('BBS_localfiles',1)
  2121.       CALL countcheck('LastFile' filenum)
  2122.       files.0=files.0+1
  2123.       newcount=alpha.0+1
  2124.       alpha.0=newcount
  2125.       files.filenum=plaindir arg
  2126.       files.filenum.0=newcount
  2127.       libnum=finddirnum(plaindir)
  2128.       PARSE VAR lynes.1 . 'KeyWords:' keywords
  2129.       alpha.newcount=LEFT(arg,22-LENGTH(WORD(lynes.2,4)))
  2130.       alpha.newcount=alpha.newcount WORD(lynes.2,4) RIGHT(filenum,5)
  2131.       alpha.newcount=alpha.newcount RIGHT(libnum,2) LEFT(plaindir,12)
  2132.       alpha.newcount=alpha.newcount STRIP(LEFT(STRIP(keywords),32))
  2133.       IF EXISTS(bbspath'Lists/Files') THEN
  2134.         x=listOPEN(f,bbspath'Lists/Files','A')
  2135.       ELSE x=listOPEN(f,bbspath'Lists/Files','W')
  2136.       IF x=0 THEN
  2137.         DO
  2138.           SAY '*** Failed to open' bbspath'Lists/Files'
  2139.           savefileflag=1
  2140.           RETURN 0
  2141.         END
  2142.       CALL WRITELN(f,filenum files.filenum)
  2143.       CALL CLOSE(f)
  2144.       IF EXISTS(bbspath'Lists/Files.ALPHA') THEN
  2145.         x=listOPEN(f,bbspath'Lists/Files.ALPHA','A')
  2146.       ELSE x=listOPEN(f,bbspath'Lists/Files.ALPHA','W')
  2147.       IF x=0 THEN
  2148.         DO
  2149.           SAY '*** Failed to open' bbspath'Lists/Files.ALPHA'
  2150.           RETURN 0
  2151.         END
  2152.       CALL WRITELN(f,alpha.newcount)
  2153.       CALL CLOSE(f)
  2154.       IF EXISTS('c:shellsort') THEN loadalphaflag=1
  2155.       ELSE sortalphaflag=1
  2156.     END
  2157. END
  2158. RETURN 0
  2159.  
  2160.  
  2161. checkfilechanges:
  2162. x=GETCLIP('BBS_FileChange')
  2163. CALL SETCLIP('BBS_FileChange')
  2164. DO ii=1 TO WORDS(x)
  2165.   fnum=WORD(x,ii)
  2166.   keywords=GETCLIP('BBS_Keywords_'fnum)
  2167.   CALL SETCLIP('BBS_Keywords_'fnum)
  2168.   num=files.fnum.0
  2169.   alpha.num=TRIM(OVERLAY(keywords,alpha.num,47,32))
  2170.   sortalphaflag=1
  2171. END
  2172. RETURN
  2173.  
  2174.  
  2175. edkeywords:
  2176. PARSE ARG kwarg
  2177. templine=''
  2178. DO WHILE LENGTH(templine)<3
  2179.   SAY
  2180.   SAY pen3'Please enter a list of keywords (or a condensed description)'def
  2181.   SAY pen3'to be used in the alphabetic list and by the search routine.'def
  2182.   SAY '    Note that only the first 32 characters will be used.'
  2183.   SAY LEFT('',43)'|'LEFT('',31,'=')'|'
  2184.   templine=getinput(0 0 ' 'RIGHT(STRIP(RIGHT(kwarg,32)),32) pen3'KeyWords: 'def)
  2185.   templine=cleanstring('0:'templine)
  2186.   templine=STRIP(LEFT(templine,32))
  2187.   SAY
  2188. END
  2189. RETURN templine
  2190.  
  2191.  
  2192. loadfiles:
  2193. SAY def
  2194. IF ~listOPEN(f,bbspath'Lists/Files','R') THEN RETURN
  2195. SAY 'Loading filelist...'
  2196. files.=''
  2197. files.0=0
  2198. DO i=1
  2199.   line=READLN(f)
  2200.   IF EOF(f) THEN BREAK
  2201.   num=WORD(line,1)
  2202.   IF DATATYPE(num,'W') THEN
  2203.     DO
  2204.       IF num<100 THEN
  2205.         IF LEFT(WORD(line,3),1)~='.' THEN
  2206.           DO
  2207.             CALL CLOSE(f)
  2208.             SAY
  2209.             SAY 'Your filelists need to be renumbered, running bbsUPDATE.rexx...'
  2210.             CALL bbsUPDATE.rexx()
  2211.             SIGNAL RESET
  2212.           END
  2213.       files.num=WORD(line,2) WORD(line,3)
  2214.     END
  2215. END
  2216. files.0=i-1
  2217. CALL CLOSE(f)
  2218. RETURN
  2219.  
  2220.  
  2221. savefilelist:
  2222. IF level=99 THEN
  2223.   IF getinput(1 1 'Update filelists now? (nY) > ')='N' THEN RETURN
  2224.  
  2225. savefilelist2:
  2226. SIGNAL OFF BREAK_E
  2227. CALL savealphalist()
  2228. filenum=countcheck('LastFile' 0)
  2229. IF filenum<1 THEN
  2230.   DO
  2231.     IF files.0>0 THEN filenum=files.0
  2232.     ELSE RETURN
  2233.   END
  2234. xarg=bbspath'Lists/Files'
  2235. IF ~listOPEN(f,xarg,'W') THEN RETURN
  2236. SAY 'Saving filelist...'
  2237. savefileflag=0
  2238. DO i=1 TO filenum
  2239.   IF files.i~='' THEN CALL WRITELN(f,i files.i)
  2240. END
  2241. CALL CLOSE(f)
  2242. IF SHOW('P','BBBBS') THEN CALL SETCLIP('BBS_localfiles',2)
  2243. RETURN
  2244.  
  2245.  
  2246. loadalpha:
  2247. ARG alflag
  2248. SAY def
  2249. IF alflag THEN CALL checkliblists()
  2250. IF liblist='' THEN alflag=0
  2251. IF loadalphaflag=1 THEN
  2252.   DO
  2253.     SAY 'Sorting using fast shellsort...'
  2254.     t=bbspath'Lists/Files.ALPHA'
  2255.     ADDRESS COMMAND 'c:shellsort -c' t t
  2256.   END
  2257. IF ~listOPEN(f,bbspath'Lists/Files.ALPHA','R') THEN RETURN
  2258. SAY 'Loading the alphabetical filelist...'
  2259. loadalphaflag=0
  2260. alpha.=''
  2261. alpha.0=0
  2262. DO i=1
  2263.   line=READLN(f)
  2264.   IF EOF(f) THEN LEAVE i
  2265.   fnum=WORD(line,3)
  2266.   IF DATATYPE(fnum,'W') THEN
  2267.     DO
  2268.       alpha.i=line
  2269.       files.fnum.0=i
  2270.       IF alflag THEN CALL updateliblists()
  2271.     END
  2272.   ELSE i=i-1
  2273. END
  2274. CALL CLOSE(f)
  2275. tf=bbspath'Lists/Files.ALPHA.add'
  2276. IF EXISTS(tf) & ~SHOW('P','BBSFILE') THEN
  2277.   IF readopen(tf) THEN
  2278.     DO
  2279.       DO i=i
  2280.         line=READLN(f)
  2281.         IF EOF(f) THEN LEAVE i
  2282.         fnum=WORD(line,3)
  2283.         IF DATATYPE(fnum,'W') THEN
  2284.           DO
  2285.             alpha.i=line
  2286.             files.fnum.0=i
  2287.           END
  2288.         ELSE i=i-1
  2289.         IF alflag THEN CALL updateliblists()
  2290.       END
  2291.       CALL CLOSE(f)
  2292.       CALL DELETE(tf)
  2293.       CALL SETCLIP('BBS_resave_local',1)
  2294.     END
  2295. alpha.0=i-1
  2296. IF alflag THEN CALL closeliblists()
  2297. DO i=1 TO 99
  2298.   IF dirs.i='' THEN ITERATE i
  2299.   dname='.'STRIP(LEFT(dirs.i,15))
  2300.   IF files.i='' THEN
  2301.     DO
  2302.       files.i=dirs.i dname
  2303.       files.0=files.0+1
  2304.     END
  2305.   sz=WORD(STATEF(libpath||dirs.i'/'dname),2)
  2306.   IF ~DATATYPE(sz,'W') THEN sz=0
  2307.   x=files.i.0
  2308.   IF ~DATATYPE(x,'W') THEN
  2309.     DO
  2310.       x=alpha.0+1
  2311.       files.i.0=x
  2312.       alpha.0=x
  2313.       CALL SETCLIP('BBS_resave_local',1)
  2314.       CALL DELETE(libpath||dirs.i'/'dname)
  2315.     END
  2316.   alpha.x=LEFT(dname,22-LENGTH(sz)) sz RIGHT(i,5) RIGHT(i,2)
  2317.   alpha.x=alpha.x LEFT(dirs.i,12) 'alphabetical files list CONTENTS'
  2318. END
  2319. IF GETCLIP('BBS_resave_local')=1 THEN
  2320.   DO
  2321.     CALL SETCLIP('BBS_resave_local')
  2322.     sortalphaflag=1
  2323.     CALL savefilelist2()
  2324.   END
  2325. SAY
  2326. RETURN
  2327.  
  2328.  
  2329. savealphalist:
  2330. SIGNAL OFF BREAK_E
  2331. IF GETCLIP('BBS_mainfiles')~='' THEN
  2332.   DO
  2333.     CALL SETCLIP('BBS_mainfiles')
  2334.     CALL loadfiles()
  2335.     CALL loadalpha(0)
  2336.   END
  2337. CALL checkliblists()
  2338. IF sortalphaflag=1 THEN
  2339.   DO
  2340.     SAY 'Alphabetizing' alpha.0 'files...'
  2341.     IF alpha.0>0 THEN CALL QSORT(1,alpha.0,alpha)
  2342.     DO i=1 TO alpha.0
  2343.       fnum=WORD(alpha.i,3)
  2344.       files.fnum.0=i
  2345.     END
  2346.   END
  2347. sortalphaflag=0
  2348. IF files.100~='' THEN
  2349.   DO
  2350.     sz=WORD(STATEF(libpath||WORD(files.100,1)'/'WORD(files.100,2)),2)
  2351.     IF DATATYPE(sz,'W') THEN
  2352.       DO
  2353.         anum=files.100.0
  2354.         alpha.anum=OVERLAY(RIGHT(sz,7),alpha.anum,17,7)
  2355.       END
  2356.   END
  2357. IF files.101~='' THEN
  2358.   DO
  2359.     sz=WORD(STATEF(libpath||WORD(files.101,1)'/'WORD(files.101,2)),2)
  2360.     IF DATATYPE(sz,'W') THEN
  2361.       DO
  2362.         anum=files.101.0
  2363.         alpha.anum=OVERLAY(RIGHT(sz,7),alpha.anum,17,7)
  2364.       END
  2365.   END
  2366. IF ~listOPEN(f,bbspath'Lists/Files.ALPHA','W') THEN RETURN
  2367. SAY 'Saving alphabetical filelists...'
  2368. DO i=1 TO alpha.0
  2369.   ii=WORD(alpha.i,3)
  2370.   IF files.ii='' THEN alpha.i='0 0' ii '100'
  2371.   IF LEFT(alpha.i,4)='0 0 ' THEN ITERATE i
  2372.   CALL WRITELN(f,alpha.i)
  2373.   IF liblist~='' THEN CALL updateliblists()
  2374. END
  2375. CALL CLOSE(f)
  2376. CALL closeliblists()
  2377. CALL bbsALPHA.rexx(files.0 SUBSTR(extension,2) arccom)
  2378. DO i=0 TO 1
  2379.   t=GETCLIP('BBS_10'i)
  2380.   IF t='' THEN ITERATE i
  2381.   CALL SETCLIP('BBS_10'i)
  2382.   num=100+i
  2383.   files.num=TRANSLATE(t,,'/')
  2384.   files.0=files.0+1
  2385.   x=alpha.0+1
  2386.   files.num.0=x
  2387.   alpha.0=x
  2388.   sz=WORD(STATEF(libpath||t),2)
  2389.   IF ~DATATYPE(sz,'W') THEN sz=0
  2390.   dnum=finddirnum(WORD(files.num,1))
  2391.   alpha.x=LEFT(WORD(files.num,2),22-LENGTH(sz)) sz '  'num RIGHT(dnum,2)
  2392.   alpha.x=alpha.x LEFT(dirs.dnum,12)
  2393.   IF i THEN alpha.x=alpha.x 'alphabetical files list CONTENTS'
  2394.   ELSE alpha.x=alpha.x 'alphabetical by library CONTENTS'
  2395.   SAY 'Added file' num t 'to the filelists.'
  2396.   SAY 'Must now resort and resave.'
  2397.   CALL SETCLIP('BBS_resave_local',1)
  2398. END
  2399. RETURN
  2400.  
  2401.  
  2402. listOPEN:
  2403. PARSE ARG fh,listfile,flag
  2404. DO i=0 TO 59 WHILE OPEN(fh,listfile,flag)=0
  2405.   IF i//4=0 THEN SAY 'Waiting' (60-i)*5 'more seconds for' listfile 'to become available...'
  2406.   CALL DELAY(250)
  2407. END
  2408. IF i>59 THEN
  2409.   DO
  2410.     SAY '*** unable to access' listfile 'list.'
  2411.     RETURN 0
  2412.   END
  2413. RETURN 1
  2414.  
  2415.  
  2416. checkliblists:
  2417. SAY 'Checking individual library filelists...'
  2418. liblist=''
  2419. lastlib=0
  2420. cnt.=0
  2421. DO i=1 TO 99
  2422.   IF dirs.i='' THEN ITERATE i
  2423.   finfo=STATEF(libpath||dirs.i'/.'STRIP(LEFT(dirs.i,15)))
  2424.   IF finfo='' THEN liblist=liblist i
  2425.   ELSE
  2426.     DO
  2427.       sz=WORD(finfo,2)
  2428.       num=files.i.0
  2429.       IF DATATYPE(num,'W') THEN
  2430.         alpha.num=OVERLAY(RIGHT(sz,7),alpha.num,17,7)
  2431.     END
  2432. END
  2433. liblist=STRIP(liblist)
  2434. DO j=1 TO WORDS(liblist)
  2435.   tt=WORD(liblist,j)
  2436.   CALL MAKEDIR(libpath||dirs.tt)
  2437.   lf1=libpath||dirs.tt'/.'STRIP(LEFT(dirs.tt,15))
  2438.   flg='W'
  2439.   IF EXISTS(libpath||dirs.tt'.txt') THEN
  2440.     DO
  2441.       ADDRESS COMMAND 'COPY' libpath||dirs.tt'.txt' lf1
  2442.       flg='A'
  2443.     END
  2444.   IF listOPEN(f,lf1,flg)=0 THEN ITERATE j
  2445.   IF flg='A' THEN CALL WRITELN(f,'')
  2446.   CALL WRITELN(f,'Filename          Bytes File# Library         KeyWords')
  2447.   CALL WRITELN(f,LEFT('=',77,'='))
  2448.   CALL CLOSE(f)
  2449. END
  2450. RETURN
  2451.  
  2452.  
  2453. updateliblists:
  2454. x=FIND(liblist,WORD(alpha.i,4))
  2455. IF x=0 THEN RETURN
  2456. tt=WORD(liblist,x)
  2457. IF tt~=lastlib THEN
  2458.   DO
  2459.     CALL CLOSE(a)
  2460.     lastlib=tt
  2461.     x=OPEN(a,libpath||dirs.tt'/.'STRIP(LEFT(dirs.tt,15)),'A')
  2462.     IF x=0 THEN
  2463.       DO
  2464.         lastlib=0
  2465.         RETURN
  2466.       END
  2467.   END
  2468. CALL WRITELN(a,alpha.i)
  2469. cnt.tt=cnt.tt+1
  2470. RETURN
  2471.  
  2472.  
  2473. closeliblists:
  2474. CALL CLOSE(a)
  2475. DO i=1 TO WORDS(liblist)
  2476.   tt=WORD(liblist,i)
  2477.   dname='.'STRIP(LEFT(dirs.tt,15))
  2478.   SAY ' 'dname
  2479.   x=OPEN(f,libpath||dirs.tt'/'dname,'A')
  2480.   IF x~=0 THEN
  2481.     DO
  2482.       CALL WRITELN(f,LEFT('-',77,'-'))
  2483.       temp='file'
  2484.       IF cnt.tt~=1 THEN temp=temp's'
  2485.       temp=cnt.tt temp'.  Last updated' DATE() 'at' TIME('C')
  2486.       temp=temp RIGHT(bbsname,76-LENGTH(temp))
  2487.       CALL WRITELN(f,temp)
  2488.       CALL CLOSE(f)
  2489.     END
  2490.   CALL MAKEDIR(bbspath'FileNotes/'dirs.tt)
  2491.   fnote=bbspath'FileNotes/'dirs.tt'/'dname
  2492.   lynes.=''
  2493.   lynes.0=5
  2494.   x=OPEN(f,fnote,'R')
  2495.   IF x=0 THEN CALL SETCLIP('BBS_resave_local',1)
  2496.   ELSE
  2497.     DO
  2498.       DO k=1
  2499.         line=READLN(f)
  2500.         IF EOF(f) THEN LEAVE k
  2501.         lynes.k=line
  2502.       END
  2503.       CALL CLOSE(f)
  2504.       lynes.0=k-1
  2505.     END
  2506.   finfo=STATEF(libpath||dirs.tt'/.'STRIP(LEFT(dirs.tt,15)))
  2507.   bt=WORD(finfo,2)
  2508.   dl=WORD(lynes.2,7)
  2509.   IF ~DATATYPE(dl,'W') THEN dl=0
  2510.   lynes.1='File: 'LEFT(tt,5)' KeyWords: alphabetical files list CONTENTS'
  2511.   lynes.2='Name: 'LEFT(dname,27)' Size:' bt 'bytes  Downloads:' dl
  2512.   lynes.3='From: 'LEFT('BBBBS',27)' Date: 'DATE() TIME('C')'  Lib: 'dirs.tt
  2513.   lynes.4=LEFT('',74,'=')
  2514.   IF lynes.5='' THEN
  2515.     lynes.5='Up to the minute alphabetical filelist of the' dirs.tt 'library.'
  2516.   IF writeopen(fnote) THEN
  2517.     DO
  2518.       DO k=1 TO lynes.0
  2519.         CALL WRITELN(f,lynes.k)
  2520.       END
  2521.       CALL CLOSE(f)
  2522.       SAY LEFT(' ',LENGTH(dname)+2)'1B'x'Mupdated.'
  2523.     END
  2524. END
  2525. RETURN
  2526.  
  2527.  
  2528. viewuser:
  2529. SAY 
  2530. SAY bak2' 'name' 'def
  2531. DO i=1 TO 18
  2532.   stuff=data.i
  2533.   IF i=13 | i=14 THEN stuff=DATE(,data.i,'S')
  2534.   SAY RIGHT(i,2)||pen3 text.i||def':' stuff
  2535. END
  2536. CALL waiting()
  2537. RETURN
  2538.  
  2539.  
  2540. edituser:
  2541. x=bbsEditUser.rexx(6000 name)
  2542. CALL loaddata()
  2543. IF x=1 THEN CALL sortconferences()
  2544. RETURN
  2545.  
  2546.  
  2547. setmsgs:
  2548. IF ~DATATYPE(bbsprefs.25,'W') THEN RETURN
  2549. data.22=''
  2550. data.23=''
  2551. SAY
  2552. line='Setting message counters to last'
  2553. IF bbsprefs.25>1 THEN line=line bbsprefs.25 'messages'
  2554. ELSE line=line 'message'
  2555. line=line 'in each conference...'
  2556. SAY line
  2557. DO i=1 TO level
  2558.   num=countcheck('LastMessage'i 0)-bbsprefs.25
  2559.   IF num<0 | msg.i.0<bbsprefs.25 THEN num=0
  2560.   lastread.i=num
  2561.   data.22=data.22 num
  2562.   data.23=data.23 0
  2563. END
  2564. SAY 'Setting file counter to last file uploaded...'
  2565. lastbrowse=countcheck('LastFile' 0)
  2566. newfilesdate=DATE('S') TIME()
  2567. RETURN
  2568.  
  2569.  
  2570. getnumber:
  2571. PARSE ARG tprompt
  2572. tnum=getinput(1 0 '  'tprompt' > ')
  2573. mask=COMPRESS(XRANGE(),'0123456789')
  2574. tnum=COMPRESS(tnum,mask)
  2575. IF ~DATATYPE(tnum,'W') THEN tnum=0
  2576. tnum=tnum%1
  2577. IF tnum>0 & tnum<10 THEN tnum='0'tnum
  2578. RETURN tnum
  2579.  
  2580.  
  2581. getbirth:
  2582. data.12=WORD(data.12,1)'  'WORD(data.12,2)'  Birthday:'
  2583. SAY pen3'Birthday Information:'def
  2584. month=getnumber('Please enter the MONTH you were born: (1-12)')
  2585. day=getnumber('Please enter the DAY   you were born: (1-31)')
  2586. year=getnumber('Please enter the YEAR  you were born:       ')
  2587. IF year<100 THEN year=year+1900
  2588. born=year||month||day
  2589. IF born<18750101 | born>(DATE('S')-50000) THEN
  2590.   DO
  2591.     born=''
  2592.     IF getinput(1 1 'Would you rather skip this question? (Ny) > ')~='Y' THEN
  2593.       CALL getbirth()
  2594.   END
  2595. data.12=WORD(data.12,1)'  'WORD(data.12,2)'  'WORD(data.12,3)' 'WORD(born,1)
  2596. RETURN
  2597.  
  2598.  
  2599. getname:
  2600. nonstop=0
  2601. CALL showuserlist()
  2602. SAY
  2603. waitchar='Q'
  2604. CALL showtext(bbspath'BBS_TEXT/NEW_USER_NAME' 1)
  2605. pline='Your name on'pen3 bbsname def'will be > '
  2606. name=getinput(1 0 pline)
  2607. name=cleanstring(1':'name)
  2608. IF name='' THEN
  2609.   DO
  2610.     SAY 'No name, no entry.  Bye!'
  2611.     SIGNAL DONE
  2612.   END
  2613. IF EXISTS(bbspath'Users/'name) | FIND(exclusion,name)>0 THEN
  2614.   DO
  2615.     SAY 'Sorry! That name is taken. Please try again.'
  2616.     RETURN 1
  2617.   END
  2618. IF getinput(1 1 'Your name on'pen3 bbsname def'will be >' name', is that correct? (nY) > ')='N' THEN
  2619.   RETURN 1
  2620. RETURN 0
  2621.  
  2622.  
  2623. /** see if name is in data */
  2624.  
  2625. checkUser:
  2626. tries=0
  2627. IF name='NEW' THEN
  2628.   DO
  2629.     name=''
  2630.     DO WHILE getname()
  2631.     END
  2632.   END
  2633. IF ~EXISTS(bbspath'Users/'name) THEN
  2634.   DO
  2635.     IF EXISTS(bbspath'BBS_TEXT/NEW') THEN
  2636.       DO
  2637.         nonstop=0
  2638.         CALL showtext(bbspath'BBS_TEXT/NEW' 1)
  2639.       END
  2640.     SAY
  2641.     defile=bbspath'BBS_TEXT/DEF.NEW_USER'
  2642.     CALL loadcourtesy()
  2643.     wordnum=FIND(courtesy,name)
  2644.     IF wordnum>0 THEN
  2645.       DO
  2646.         SAY name', is on the Courtesy List. You will be granted immediate access.'
  2647.         courtesy=STRIP(DELWORD(courtesy,wordnum,1))
  2648.         IF writeopen(bbspath'Lists/Courtesy') THEN
  2649.           DO
  2650.             DO i=1 TO WORDS(courtesy)
  2651.               CALL WRITELN(f,WORD(courtesy,i))
  2652.             END
  2653.             CALL CLOSE(f)
  2654.           END
  2655.         defile=bbspath'BBS_TEXT/DEF.COURTESY'
  2656.       END
  2657.     ELSE IF bbsprefs.7=0 THEN SAY name', You have new user access.'
  2658.     IF readlines(defile 1) THEN SIGNAL DONE
  2659.     data.=''
  2660.     data.0=27
  2661.     DO i=6 TO 22
  2662.       data.i=lynes.i
  2663.     END
  2664.     data.12=DATE('S')'  'TIME('C')
  2665.     data.13=data.12
  2666.     lastondate=DATE('I')-1
  2667.     lastontime=TIME('C')
  2668.     DO i=60 TO 2 BY -1
  2669.       SAY RIGHT('- 'i' -',14)
  2670.     END
  2671.     data.7=getinput(1 0 'What number is now at the top of your screen? > ')
  2672.     IF data.7<17 | data.7>75 THEN data.7=20
  2673.     SAY 'Please enter the password you would like to use here.'
  2674.     data.5=getinput(1 0 'Enter Password: ')
  2675.     DO WHILE getinput(1 1 'Your password on' bbsname 'will be :' data.5 ', is that correct? (nY) > ')='N'
  2676.       data.5=getinput(1 0 'Enter Password: ')
  2677.     END
  2678.     IF data.5='' THEN
  2679.       DO
  2680.         line=name 'refused to enter a password.'
  2681.         SIGNAL DONE
  2682.       END
  2683.     data.1=''
  2684.     DO WHILE data.1=''
  2685.       data.1=getinput(0 0 'Full (real) Name: ')
  2686.       IF data.1='' THEN SAY 'You MUST leave your real name!'
  2687.     END
  2688.     data.2=getinput(0 0 'Street: ')
  2689.     data.3=getinput(0 0 'City, State Zip: ')
  2690.     data.4=''
  2691.     DO WHILE data.4=''
  2692.       data.4=getinput(0 0 'Voice Phone (including areacode): ')
  2693.       IF data.4='' THEN
  2694.         SAY sysop 'MUST be able to reach you by phone to validate you!'
  2695.     END
  2696.     CALL getbirth()
  2697.     IF bbsprefs.8 THEN
  2698.       DO
  2699.         newufile=bbspath'Lists/NEW_USERS'
  2700.         IF EXISTS(newufile) THEN ok=OPEN(f,newufile,'A')
  2701.         ELSE
  2702.           DO
  2703.             ok=OPEN(f,newufile,'W')
  2704.             IF ok~=0 THEN CALL WRITELN(f,'*** New Users ***')
  2705.           END
  2706.         IF ok~=0 THEN
  2707.           DO
  2708.             temp=RIGHT(TIME('C'),7) COMPRESS(DATE())
  2709.             temp=temp LEFT(name,24)'=' data.1'  'data.4
  2710.             CALL WRITELN(f,temp) 
  2711.           END
  2712.         CALL CLOSE(f)
  2713.       END
  2714.     data.9=getinput(0 0 'Computer: ')
  2715.     data.10=getinput(0 0 'Interests: ')
  2716.     test=getinput(1 1 pen3'Do you want other users to see your STREET address? (Ny) > 'def)
  2717.     IF test='Y' THEN data.8=data.8 'STREET'
  2718.     test=getinput(1 1 pen3'Do you want other users to see your PHONE number? (Ny) > 'def)
  2719.     IF test='Y' THEN data.8=data.8 'PHONE'
  2720.     IF bbsprefs.7>0 THEN
  2721.       DO
  2722.         data.20=bbsprefs.7
  2723.         CALL do_eleven(60 bbsprefs.16 bbsprefs.16-1)
  2724.       END
  2725.     SAY
  2726.     CALL setdata()
  2727.     IF data.20=0 THEN
  2728.       SAY 'Thank you, the sysop will give you higher access soon.'
  2729.     ELSE CALL setmsgs()
  2730.     SAY
  2731.     SAY 'Please feel free to leave additional info by using [C]omment.'
  2732.     SAY
  2733.     CALL saveData(1)
  2734.     SAY 'Adding' name 'to the user list...'
  2735.     newpassword=data.5
  2736.     sortuserflag=1
  2737.     temp=countcheck('Users' 0)+1
  2738.     CALL countcheck('Users' temp)
  2739.     CALL DELETE(bbspath'Lists/USERS')
  2740.   END
  2741. ELSE
  2742.   DO
  2743.     IF loaddata()=0 THEN SIGNAL DONE
  2744.     city=docity(data.3)
  2745.     PARSE VAR data.11 amins . . . ttimes . . . atimes .
  2746.     lastondate=DATE('I',WORD(data.13,1),'S')
  2747.     lastontime=WORD(data.13,2)
  2748.     IF DATE('I')>lastondate | level>=sysoplevel THEN atimes=ttimes
  2749.     IF level=99 THEN amins=120
  2750.     data.13=DATE('S')'  'TIME()
  2751.     CALL do_eleven(amins ttimes atimes-1)
  2752.     passprompt='Enter Password: '
  2753.     DO tries=1 TO 3
  2754.       OPTIONS PROMPT passprompt
  2755.       PULL newpassword
  2756.       SAY ''
  2757.       IF(password=newpassword) THEN LEAVE tries; /* correct password */
  2758.       IF tries=3 THEN
  2759.         DO
  2760.           SAY 
  2761.           SAY 'Access terminated.'
  2762.           line='*** Bad password ***' newpassword '***'
  2763.           SAY line
  2764.           SIGNAL OUT2
  2765.         END
  2766.       SAY lineup'                                 '
  2767.       passprompt='Incorrect.  Password: ' /* ask again */
  2768.     END
  2769.   END
  2770. CALL DELAY(14)
  2771. SAY 
  2772. RETURN
  2773.  
  2774.  
  2775. do_eleven:
  2776. ARG am tc at .
  2777. data.11=am 'minutes per call,' tc 'calls per day,'
  2778. data.11=data.11 at 'more calls today'
  2779. RETURN
  2780.  
  2781.  
  2782. saveData:
  2783. ARG messflag .
  2784. IF data.5='' THEN RETURN
  2785. SAY 'Updating...             'lineup
  2786. IF newfilesdate~='' THEN data.16=lastbrowse newfilesdate
  2787. ELSE IF lastbrowse>0 THEN
  2788.   DO
  2789.     IF WORDS(data.16)>1 THEN data.16=DELWORD(data.16,1,1)
  2790.     ELSE data.16=DATE('S') TIME()
  2791.     data.16=lastbrowse data.16
  2792.   END
  2793. IF messflag THEN
  2794.   DO
  2795.     userexclude.=0
  2796.     DO si=1 TO WORDS(data.22)
  2797.       IF WORD(data.22,si)=-1 THEN userexclude.si=1
  2798.     END
  2799.     data.22=''
  2800.     data.23=''
  2801.     DO si=1 TO level
  2802.       IF ~DATATYPE(lastread.si,'W') THEN lastread.si=0
  2803.       IF userexclude.si THEN data.22=data.22 '-1'
  2804.       ELSE data.22=data.22 lastread.si
  2805.       IF ~DATATYPE(totwrit.si,'W') THEN totwrit.si=0
  2806.       data.23=data.23 totwrit.si
  2807.     END
  2808.   END
  2809. IF writeopen(bbspath'USERS/'name)=0 THEN RETURN
  2810. IF data.0<27 THEN data.0=27
  2811. DO i=1 TO data.0
  2812.   CALL WRITELN(f,data.i)
  2813. END
  2814. CALL CLOSE(f)
  2815. SAY 'User' name 'has been updated.'
  2816. RETURN
  2817.  
  2818.  
  2819. loaddata:
  2820. IF name='' THEN RETURN 0
  2821. IF ~readopen(bbspath'USERS/'name) THEN RETURN 0
  2822. data.=''
  2823. DO i=1
  2824.   line=READLN(f)
  2825.   IF EOF(f) THEN BREAK
  2826.   data.i=line
  2827. END
  2828. data.0=i-1
  2829. CALL CLOSE(f)
  2830. winnings=WORD(data.18,1)
  2831. IF ~DATATYPE(winnings,'N') THEN winnings=0
  2832.  
  2833. setdata:
  2834. IF WORDS(data.16)<3 THEN data.16='0 19900101 00:00:00'
  2835. lastbrowse=WORD(data.16,1)
  2836. IF ~DATATYPE(lastbrowse,'W') THEN lastbrowse=0
  2837. level=data.20
  2838. DO i=1 TO level
  2839.   lastread.i=WORD(data.22,i)
  2840.   IF ~DATATYPE(lastread.i,'W') THEN lastread.i=0
  2841.   totwrit.i=WORD(data.23,i)
  2842.   IF ~DATATYPE(totwrit.i,'W') THEN totwrit.i=0
  2843. END
  2844. password=data.5
  2845. IF ~DATATYPE(data.7,'W') THEN data.7=20
  2846. IF data.7<5 THEN data.7=5
  2847. IF FIND(UPPER(data.8),'TERSE')>0 THEN terseflag=1
  2848. ELSE terseflag=0
  2849. IF FIND(UPPER(data.8),'COLOR')>0 THEN colorflag=1
  2850. ELSE colorflag=0
  2851. CALL colors(colorflag)
  2852. IF FIND(UPPER(data.8),'CLEAR')>0 THEN clr='0C'x
  2853. ELSE clr=''
  2854. menu='ALL'
  2855. IF FIND(UPPER(data.8),'MENUS')>0 THEN
  2856.   DO
  2857.     menuflag=1
  2858.     menu='MAIN'
  2859.   END
  2860. ELSE IF FIND(UPPER(data.8),'MENU')>0 THEN menuflag=1
  2861. ELSE menuflag=0
  2862. IF level=0 THEN menu='NEW'
  2863. IF DATATYPE(WORD(data.11,3),'W') THEN
  2864.   DO
  2865.     PARSE VAR data.11 amins . atimes .
  2866.     CALL do_eleven(amins bbsprefs.16 atimes)
  2867.   END
  2868. data.21=UPPER(data.21)
  2869. CALL MAKEDIR(bbspath'Friends')
  2870. alias.=''
  2871. alias.0=0
  2872. realname.=''
  2873. CALL CLOSE(f)
  2874. IF OPEN(f,bbspath'Friends/'name,'R')=0 THEN RETURN 1
  2875. DO i=1
  2876.   line=READLN(f)
  2877.   IF EOF(f) THEN LEAVE i
  2878.   alias.i=WORD(line,1)
  2879.   realname.i=WORD(line,2)
  2880. END
  2881. alias.0=i-1
  2882. CALL CLOSE(f)
  2883. RETURN 1
  2884.  
  2885.  
  2886. switchmenuflag:
  2887. IF menuflag=1 THEN
  2888.   DO
  2889.     menuflag=0
  2890.     noff='OFF'
  2891.   END
  2892. ELSE
  2893.   DO
  2894.     menuflag=1
  2895.     noff='ON'
  2896.   END
  2897. SAY 'Menus turned' pen3||noff||def'.'
  2898. SAY 'To make a permanent change, add or delete MENU(S) from [Y]our userdata item 8.'
  2899. RETURN
  2900.  
  2901.  
  2902. switchcolors:
  2903. IF colorflag=1 THEN
  2904.   DO
  2905.     colorflag=0
  2906.     noff='OFF'
  2907.   END
  2908. ELSE
  2909.   DO
  2910.     colorflag=1
  2911.     noff='ON'
  2912.   END
  2913. CALL colors(colorflag)
  2914. SAY 'Color turned' pen3||noff||def'.'
  2915. SAY 'To make a permanent change, add or delete COLOR from [Y]our userdata item 8.'
  2916. RETURN
  2917.  
  2918.  
  2919. /* ANSI pen color codes */
  2920. colors:
  2921. ARG onoff
  2922. IF onoff THEN
  2923.   DO
  2924.     def='';  /* default */
  2925.     pen0='';  pen1='';  pen2='';  pen3=''
  2926.     pen4='';  pen5='';  pen6='';  pen7=''
  2927.     bak0='';  bak1='';  bak2='';  bak3=''
  2928.     bak4='';  bak5='';  bak6='';  bak7=''
  2929.   END
  2930. ELSE
  2931.   DO
  2932.     pen0=''; pen1=''; pen2=''; pen3=''; pen4=''; pen5=''; pen6=''; pen7=''
  2933.     bak0=''; bak1=''; bak2=''; bak3=''; bak4=''; bak5=''; bak6=''; bak7=''
  2934.     def='';
  2935.   END
  2936. RETURN
  2937.  
  2938.  
  2939. sortinfofiles:
  2940. infolist=SHOWDIR(bbspath'Information')
  2941. IF infolist='' THEN
  2942.   DO
  2943.     SAY 
  2944.     SAY pen3'No files are currently in the Information drawer.'def
  2945.     SAY 
  2946.     RETURN 1
  2947.   END
  2948. IF ~DATATYPE(sortinfo.0,'W') THEN
  2949.   DO
  2950.     info.=''
  2951.     sortinfo.=''
  2952.     info.0=WORDS(infolist)
  2953.     DO i=1 TO info.0
  2954.       info.i=WORD(infolist,i)
  2955.     END
  2956.     SAY 'Sorting..'
  2957.     IF info.0>0 THEN CALL QSORT(1,info.0,info)
  2958.     sortinfo.0=info.0%3
  2959.     IF (info.0//3)>0 THEN sortinfo.0=sortinfo.0+1
  2960.     DO i=1 TO sortinfo.0
  2961.       sortinfo.i=''
  2962.       DO j=0 TO 2
  2963.         k=i+j*sortinfo.0
  2964.         IF k<=info.0 THEN
  2965.           DO
  2966.             sortinfo.i=sortinfo.i RIGHT(k,3)'.' LEFT(info.k,19)
  2967.             infocount=WORD(STATEF(bbspath'Information/'info.k),8)
  2968.             sortinfo.i.0=sortinfo.i.0||RIGHT(infocount,5) LEFT(info.k,19)
  2969.           END
  2970.       END
  2971.     END
  2972.     SAY lineup'         'lineup
  2973.   END
  2974. RETURN 0
  2975.  
  2976.  
  2977. information:
  2978. IF sortinfofiles() THEN RETURN
  2979. SAY pen3'These text files are available for reading online...'def
  2980. num=1
  2981. readcount=-1
  2982. DO infoloop=1
  2983.   IF num=0 THEN
  2984.     DO
  2985.       IF readcount~=-1 THEN
  2986.         DO
  2987.           sortinfo.0=''
  2988.           IF sortinfofiles() THEN RETURN
  2989.         END
  2990.       SAY CENTER('- Number of accesses per file -',75)
  2991.     END
  2992.   SAY pen3||LEFT('-',75,'-')||def
  2993.   DO i=1 TO sortinfo.0
  2994.     IF num=0 THEN SAY sortinfo.i.0
  2995.     ELSE SAY sortinfo.i
  2996.   END
  2997.   SAY pen3||LEFT('-',75,'-')||def
  2998.   IF num=0 THEN
  2999.     DO
  3000.       CALL waiting()
  3001.       num=1
  3002.       ITERATE infoloop
  3003.     END
  3004.   num=getinput(1 0 pen3'Select Number Of Information File To View. 0=Stats > 'def)
  3005.   IF num=0 THEN ITERATE infoloop
  3006.   IF ~DATATYPE(num,'W') | num<1 | num>info.0 THEN RETURN
  3007.   readcount=STATEF(bbspath'Information/'info.num)
  3008.   readbytes=WORD(readcount,2)
  3009.   SAY '  'info.num 'is' readbytes 'bytes.'
  3010.   SAY 'Loading File...'
  3011.   CALL Increment.rexx(bbspath'Information/'info.num)
  3012.   CALL readlines(bbspath'Information/'info.num 1)
  3013.   CALL cleanline(0)
  3014.   SAY '    'lynes.0 'lines.'
  3015.   CALL seelines(0)
  3016.   IF waitchar~='Q' THEN CALL waiting()
  3017.   nonstop=0
  3018. END
  3019. RETURN
  3020.  
  3021.  
  3022. newfiles:
  3023. SAY 
  3024. test=getinput(1 1 'Show one library only? (Ny) > ')
  3025. IF test='Y' THEN
  3026.   IF chdir()>0 THEN RETURN
  3027. SAY 'Searching for new (un-browsed) files since' DATE(,WORD(data.16,2),'S') 'at' WORD(data.16,3)'...'
  3028. lastbrowz=WORD(data.16,1)
  3029. lastfile=countcheck('LastFile' 0)
  3030.  
  3031. newfiles2:
  3032. IF lastbrowz>=lastfile THEN
  3033.   DO
  3034.     lastbrowz=0
  3035.     SAY pen3'No new files. Listing backwards by date from last file uploaded...'def
  3036.   END
  3037. ELSE newfilesflag=1
  3038. j=0
  3039. IF test='Y' THEN
  3040.   DO
  3041.     filecount=WORDS(SHOWDIR(bbspath'FileNotes/'plaindir))-1
  3042.     CALL busywait(4 1)
  3043.   END
  3044. DO ni=lastfile TO lastbrowz+1 BY -1
  3045.   IF files.ni~='' THEN
  3046.     DO
  3047.       IF test='Y' THEN 
  3048.         DO
  3049.           IF ni>1 THEN CALL busywait(60 ni lastfile-lastbrowz)
  3050.           IF j>=filecount THEN LEAVE ni
  3051.           IF UPPER(LEFT(WORD(files.ni,1),12))~=UPPER(LEFT(plaindir,12)) THEN
  3052.             ITERATE ni
  3053.         END
  3054.       jj=files.ni.0
  3055.       IF WORD(alpha.jj,4)>level | FIND(data.21,UPPER(WORD(files.ni,1)))>0 THEN
  3056.         ITERATE ni  /* unauthorized */
  3057.       IF test='Y' THEN CALL busywait(4 0)
  3058.       j=j+1
  3059.       IF j=1 THEN CALL fileheader()
  3060.       SAY LEFT(alpha.jj,76)
  3061.       IF (j+2)//(linesperpage-1)=0 THEN
  3062.         IF waiting2() THEN LEAVE ni
  3063.       IF test='Y' THEN CALL busywait(4 1)
  3064.     END
  3065. END
  3066. IF test='Y' THEN CALL busywait(4 0)
  3067. IF j//linesperpage~=0 THEN CALL waiting()
  3068. IF j=0 & newfilesflag=1 THEN
  3069.   DO
  3070.     lastbrowz=999999
  3071.     newfilesflag=0
  3072.     CALL newfiles2()
  3073.   END
  3074. IF test~='Y' THEN
  3075.   DO
  3076.     CALL newinfo()
  3077.     IF lynes.0>0 THEN CALL waiting()
  3078.   END
  3079. nonstop=0
  3080. RETURN
  3081.  
  3082.  
  3083. newinfo:
  3084. lynes.=''
  3085. lynes.0=0
  3086. dm=DATE(,WORD(data.16,2),'S')
  3087. PARSE VAR dm da' 'mo' 'yr .
  3088. yr=RIGHT(yr,2)
  3089. sincedate=da'-'mo'-'yr
  3090. startline=1
  3091. arg=bbspath'Information'
  3092. IF WORD(STATEF(arg),5)>lastondate THEN
  3093.   DO
  3094.     ADDRESS COMMAND 'C:LIST >'scratch'/locdirlist' arg 'NOHEAD DATES SINCE' sincedate
  3095.     IF WORD(STATEF(scratch'/locdirlist'),2)>3 THEN
  3096.       DO
  3097.         lynes.startline=pen1||bak2' New or Updated Information Files. Enter'def pen3'I'def bak2'from the main menu to read 'def
  3098.         CALL readlines(scratch'/locdirlist' startline+1)
  3099.       END
  3100.   END
  3101. arg=bbspath'Profiles'
  3102. IF level>0 & WORD(STATEF(arg),5)>lastondate THEN
  3103.   DO
  3104.     ADDRESS COMMAND 'C:LIST >'scratch'/locdirlist' arg 'NOHEAD DATES SINCE' sincedate
  3105.     IF WORD(STATEF(scratch'/locdirlist'),2)>3 THEN
  3106.       DO
  3107.         startline=lynes.0+2
  3108.         lynes.startline=pen1||bak2' New or Updated User Profiles. Enter'def pen3'&'def bak2'from the main menu to read 'def
  3109.         CALL readlines(scratch'/locdirlist' startline+1)
  3110.       END
  3111.   END
  3112. arg=bbspath'rexxDoors/Data/Polls'
  3113. IF level>0 & WORD(STATEF(arg),5)>lastondate THEN
  3114.   DO
  3115.     startline=lynes.0+2
  3116.     lynes.startline=pen1||bak2' Voting Activity. Enter'def pen3'J'def bak2'from the main menu, then select Polling_Place 'def
  3117.     lynes.0=startline
  3118.   END
  3119. IF logonflag=1 THEN nonstop=1
  3120. IF lynes.0>0 THEN CALL seelines(1)
  3121. nonstop=0
  3122. RETURN
  3123.  
  3124.  
  3125. chdir:
  3126. string=''
  3127. SAY pen3||LEFT('-',75,'-')||def
  3128. DO i=1 TO libs.0
  3129.   SAY libs.i
  3130. END
  3131. SAY pen3||LEFT('-',75,'-')||def
  3132. dirnum=getinput(1 0 pen3'Select Library Number: 'def)
  3133. IF clr~='' THEN SAY clr
  3134. IF ~DATATYPE(dirnum,'W') THEN
  3135.   DO
  3136.     waitchar=dirnum
  3137.     RETURN 2
  3138.   END
  3139.  
  3140. chdir2:
  3141. IF dirnum<1 | dirnum>99 THEN
  3142.   DO
  3143.     waitchar=dirnum
  3144.     RETURN 1
  3145.   END
  3146. IF dirs.dirnum='' THEN
  3147.   DO
  3148.     SAY pen3'That library number is currently un-assigned.'def
  3149.     RETURN 1
  3150.   END
  3151. IF dirnum>level | FIND(data.21,UPPER(dirs.dirnum))>0 THEN
  3152.   DO
  3153.     SAY pen3'You do not have authorization for that library!'def
  3154.     RETURN 1
  3155.   END
  3156. td=libpath||dirs.dirnum
  3157. CALL MAKEDIR(td)
  3158. CALL setdir(td)
  3159. IF libtext=0 THEN
  3160.   IF EXISTS(td'/.'STRIP(LEFT(dirs.dirnum,15))) THEN RETURN 0
  3161. t=libpath||plaindir'.txt'
  3162. IF terseflag | ~EXISTS(t) THEN RETURN 0
  3163. nonstop=1
  3164. SAY
  3165. CALL showtext(t 0)
  3166. SAY
  3167. RETURN 0
  3168.  
  3169.  
  3170. since:
  3171. dm=DATE(,WORD(data.16,2),'S')
  3172. SAY 
  3173. SAY 'New files or files moved since' dm
  3174. CALL listsince()
  3175. CALL showtext(scratch'/locdirlist' 1)
  3176. RETURN
  3177.  
  3178.  
  3179. listsince:
  3180. dm=DATE(,WORD(data.16,2),'S')
  3181. PARSE VAR dm da' 'mo' 'yr .
  3182. yr=RIGHT(yr,2)
  3183. sincedate=da'-'mo'-'yr
  3184. ADDRESS COMMAND 'C:list >'scratch'/locdirlist' directory 'DATES SINCE' sincedate
  3185. RETURN
  3186.  
  3187.  
  3188. list:
  3189. onetime=0
  3190. IF DATATYPE(arg,'W') THEN onetime=1
  3191. ELSE arg=''
  3192. DO listloop=1
  3193.   IF DATATYPE(arg,'W') THEN
  3194.     DO
  3195.       dirnum=arg
  3196.       arg=''
  3197.       IF chdir2()>0 THEN RETURN
  3198.       CALL listsimple()
  3199.       IF waitchar='Q' | onetime THEN LEAVE listloop
  3200.     END
  3201.   ELSE IF arg='' THEN
  3202.     DO
  3203.       libtext=0
  3204.       IF chdir()>0 THEN
  3205.         DO
  3206.           libtext=1
  3207.           RETURN
  3208.         END
  3209.       test='Y'
  3210.       CALL showalpha2()
  3211.       arg=''
  3212.       IF waitchar='Q' THEN waitchar=''
  3213.       IF waitchar~='' THEN RETURN
  3214.       ITERATE listloop
  3215.     END
  3216.   ELSE RETURN
  3217. END
  3218. RETURN
  3219.  
  3220.  
  3221. listsimple:
  3222. ADDRESS COMMAND 'C:list >'scratch'/locdirlist' directory 'DATES'
  3223. IF readlines(scratch'/locdirlist' 1) THEN RETURN
  3224. IF lynes.0>3 THEN
  3225.   DO
  3226.     SAY pen3'Sorting...'def||lineup
  3227.     linesave=lynes.1  /* these 4 lines put in to leave dir title at top */
  3228.     lynes.1='0'
  3229.     IF lynes.0>1 THEN CALL QSORT(1,lynes.0-1,lynes)
  3230.     CALL DELAY(14)
  3231.     lynes.1=linesave
  3232.   END
  3233. CALL seelines(1)
  3234. nonstop=0
  3235. CALL waiting()
  3236. RETURN
  3237.  
  3238.  
  3239. browse:
  3240. curdironly=0
  3241. brdir=PRAGMA('D')
  3242. brfilenum=1
  3243. nonstop=0
  3244. IF files.0<1 THEN RETURN
  3245. lastfile=countcheck('LastFile' 0)
  3246. IF lastfile<1 THEN RETURN
  3247. onearg=0
  3248. IF arg='' THEN
  3249.   DO
  3250.     lin='Browsing'
  3251.     test=getinput(1 1 'Browse one library only? (Ny) > ')
  3252.     IF test='Y' THEN
  3253.       DO
  3254.         IF chdir()>0 THEN RETURN
  3255.         curdironly=1
  3256.         lin=lin 'the' pen3||plaindir||def 'library'
  3257.         t=libpath||plaindir'.txt'
  3258.         IF edinfo(t,plaindir,'File Library') THEN RETURN
  3259.       END
  3260.     ELSE lin=lin 'all file libraries'
  3261.     lin=lin 'backwards from latest file.'
  3262.     SAY lin
  3263.     SAY
  3264.   END
  3265. ELSE onearg=1
  3266. i=0
  3267. IF arg='' | UPPER(arg)='NEW' | UPPER(arg)='ALL' THEN
  3268.   DO lastfileloop=1
  3269.     IF lastfile<1 THEN RETURN
  3270.     arg=WORD(files.lastfile,2)
  3271.     brfilenum=lastfile
  3272.     IF WORD(files.lastfile,2)~='' THEN LEAVE lastfileloop
  3273.     lastfile=lastfile-1
  3274.   END
  3275. ELSE IF DATATYPE(arg,'W') THEN
  3276.   DO
  3277.     brfilenum=arg
  3278.     arg=WORD(files.arg,2)
  3279.     IF arg='' THEN
  3280.       DO
  3281.         SAY 'File number' brfilenum 'does not exist in the current libraries!'
  3282.         RETURN
  3283.       END
  3284.   END
  3285. ELSE
  3286.   DO
  3287.     IF onearg THEN CALL busywait(4 1)
  3288.     DO ni=lastfile TO 1 BY -1
  3289.       IF onearg THEN CALL busywait(60 ni lastfile)
  3290.       IF UPPER(WORD(files.ni,2))~=UPPER(arg) THEN ITERATE ni
  3291.       brfilenum=ni
  3292.       CALL busywait(4 0)
  3293.       LEAVE ni
  3294.     END
  3295.     IF ni<1 THEN
  3296.       DO
  3297.         SAY 'Unable to find a file description for' pen3||arg||def'.'
  3298.         RETURN
  3299.       END
  3300.   END
  3301. IF ~curdironly THEN CALL setdir(libpath||WORD(files.brfilenum,1))
  3302. savearg=arg
  3303. IF brfilenum>lastfile THEN brfilenum=lastfile
  3304. newfilesdate=DATE('S') TIME()
  3305. DO browseloop=1
  3306.   IF curdironly THEN CALL busywait(4 1)
  3307.   DO ni=brfilenum TO 0 BY -1
  3308.     IF ni=0 THEN LEAVE browseloop
  3309.     IF files.ni='' THEN ITERATE ni
  3310.     IF onearg THEN
  3311.       DO
  3312.         CALL busywait(60 ni lastfile)
  3313.         IF UPPER(arg)~=UPPER(WORD(files.ni,2)) THEN ITERATE ni
  3314.         IF (ni//30)>0 THEN CALL busywait(4 1)
  3315.         LEAVE ni
  3316.       END
  3317.     testdir=UPPER(WORD(files.ni,1))
  3318.     IF curdironly & UPPER(plaindir)~=UPPER(testdir) THEN
  3319.       DO
  3320.         IF ni>lastbrowse THEN lastbrowse=ni
  3321.         IF ni>0 THEN CALL busywait(60 ni lastfile)
  3322.         ITERATE ni
  3323.       END
  3324.     IF FIND(data.21,testdir)>0 | finddirnum(testdir)>level THEN
  3325.       DO
  3326.         IF ni>lastbrowse THEN lastbrowse=ni
  3327.         ITERATE ni
  3328.       END
  3329.     LEAVE ni
  3330.   END
  3331.   IF curdironly | onearg THEN CALL busywait(4 0)
  3332.   onearg=0
  3333.   IF ni=0 THEN brfilenum=lastbrowse
  3334.   ELSE brfilenum=ni
  3335.   argname=WORD(files.brfilenum,2)
  3336.   IF argname='' THEN RETURN
  3337.   CALL setdir(libpath||WORD(files.brfilenum,1))
  3338.   arg=bbspath'FileNotes/'plaindir'/'argname
  3339.   CALL readlines(arg 1)
  3340.   IF nonstop=1 THEN brostop=1
  3341.   ELSE brostop=0
  3342.   CALL seelines(1)
  3343.   IF brfilenum>lastbrowse THEN lastbrowse=brfilenum
  3344.   IF brostop THEN
  3345.     DO
  3346.       SAY
  3347.       nonstop=1
  3348.       brfilenum=brfilenum-1
  3349.     END
  3350.   ELSE
  3351.     DO
  3352.       line=''
  3353.       endtest=UPPER(RIGHT(argname,4))
  3354.       IF FIND('.ARC .ARJ .DMS .LZH .LHA .LZX .RUN .ZIP .ZOO',endtest)>0 THEN
  3355.         line='['pen3'C'def']ontents ['pen3'D'def']ownload'
  3356.       ELSE line='['pen3'D'def']ownload'
  3357.       IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3358.         line=line '['pen3'E'def']dit'
  3359.       IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3360.         line=line '['pen3'K'def']ill'
  3361.       IF level>sysoplevel THEN line=line '['pen3'L'def']ib'
  3362.       line=line '['pen3'M'def']ark ['pen3'N'def']on-Stop'
  3363.       IF endtest='.TXT' | UPPER(argname)='.'UPPER(STRIP(LEFT(plaindir,15))) THEN
  3364.         line=line '['pen3'R'def']ead'
  3365.       line=line '['pen3'Q'def']uit ['pen3'?'def'] > '
  3366.       brcom=getinput(1 0 line)
  3367.       IF DATATYPE(brcom,'W') THEN
  3368.         DO
  3369.           brfilenum=brcom+1
  3370.           IF brfilenum>lastfile THEN brfilenum=lastfile+1
  3371.           IF brfilenum<1 THEN brfilenum=1
  3372.           SAY
  3373.         END
  3374.       ELSE brcom=LEFT(brcom,1)
  3375.       CALL cleanline(0)
  3376.       IF brcom='Q' THEN LEAVE browseloop
  3377.       IF brcom='M' THEN
  3378.         DO
  3379.           wordnum=FIND(data.25,brfilenum)
  3380.           IF wordnum=0 THEN
  3381.             DO
  3382.               data.25=STRIP(data.25 brfilenum)
  3383.               SAY lineup||argname 'marked for next download.'
  3384.               SAY
  3385.             END
  3386.           ELSE
  3387.             DO
  3388.               data.25=STRIP(DELWORD(data.25,wordnum,1))
  3389.               SAY argname 'removed from download list.'
  3390.             END
  3391.         END
  3392.       IF brcom='H' | brcom='?' THEN
  3393.         DO
  3394.           SAY pen3' - HELP with the Browse Files commands -'def
  3395.           SAY ' RETURN reads the next file description in line.'
  3396.           SAY ' 34 will display the description of file number 34, if it exists.'
  3397.           SAY ' C  displays the contents of an archived (arc dms lzh lha zip zoo) file.'
  3398.           SAY ' D  displays the download menu.'
  3399.           IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3400.             DO
  3401.           SAY ' E  puts this file description into the online Editor.'
  3402.           SAY ' K  deletes a file you uploaded. you cannot Kill others!'
  3403.             END
  3404.           IF level>sysoplevel THEN
  3405.           SAY ' L  move file and description to new Library and/or rename.'
  3406.           SAY ' M  mark/unmark the current file for the next download'
  3407.           SAY ' N  displays all descriptions without pausing. CTRL-E to Exit!'
  3408.           SAY ' R  displays file as text. - ONLY FILES THAT END IN .TXT -'
  3409.           SAY ' Q  returns to the main menu(s). (Quit)'
  3410.           SAY
  3411.           CALL waiting()
  3412.           IF waitchar='Q' THEN LEAVE browseloop
  3413.         END
  3414.       ELSE IF brcom='L' & level>sysoplevel THEN
  3415.         DO
  3416.           curdir=PRAGMA('D')
  3417.           IF getinput(1 1 'Rename' argname '? (Ny) > ')='Y' THEN
  3418.             DO
  3419.               newarg=getinput(0 0 'Rename' argname 'to ')
  3420.               IF newarg~='' THEN
  3421.                 DO
  3422.                   IF is_here(newarg) THEN ITERATE browseloop
  3423.                   IF wi=999999 THEN ITERATE browseloop
  3424.                   IF EXISTS(libpath||filedir'/'newarg) THEN
  3425.                     DO
  3426.                       SAY
  3427.                       SAY '***' newarg 'already exists!'
  3428.                       SAY
  3429.                       ITERATE browseloop
  3430.                     END
  3431.                   junk=getinput(1 1 'Are you SURE you want to rename' argname 'to' newarg'? (Ny) ')
  3432.                   IF junk='Y' THEN
  3433.                     DO
  3434.                       lynes.2=OVERLAY(newarg,lynes.2,7,25)
  3435.                       comment=WORD(STATEF(arg),8)
  3436.                       CALL DELETE(arg)
  3437.                       arg=bbspath'FileNotes/'plaindir'/'newarg
  3438.                       CALL savelines(arg)
  3439.                       IF comment='' THEN
  3440.                         DO
  3441.                           mpath=libpath||plaindir
  3442.                           IF RENAME(mpath'/'argname,mpath'/'newarg)=0 THEN
  3443.                             SAY 'Rename failed on main file!'
  3444.                         END
  3445.                       ELSE
  3446.                         DO
  3447.                           t=LASTPOS('/',comment)
  3448.                           IF t=0 THEN t=LASTPOS(':',comment)
  3449.                           mpath=LEFT(comment,t-1)
  3450.                           IF RENAME(comment,mpath'/'newarg)=1 THEN
  3451.                             ADDRESS COMMAND 'C:FileNote' arg mpath'/'newarg
  3452.                           ELSE SAY 'Rename failed on external file!'
  3453.                         END
  3454.                       files.brfilenum=STRIP(WORD(files.brfilenum,1)) newarg
  3455.                       anum=files.brfilenum.0
  3456.                       alpha.anum=OVERLAY(newarg,alpha.anum,1,WORDINDEX(alpha.anum,2)-2)
  3457.                       argname=newarg
  3458.                       sortalphaflag=1
  3459.                       savefileflag=1
  3460.                       CALL DELETE(libpath||plaindir'/.'STRIP(LEFT(plaindir,15)))
  3461.                     END
  3462.                 END
  3463.             END
  3464.           mvdir=getinput(0 0 'Move' argname 'to Library (name|number) ')
  3465.           IF mvdir~='' THEN
  3466.             DO
  3467.               IF DATATYPE(mvdir,'W') THEN
  3468.                 DO
  3469.                   dirnum=mvdir
  3470.                   IF UPPER(dirs.dirnum)~=UPPER(WORD(files.brfilenum,1)) THEN
  3471.                     DO
  3472.                       IF chdir2()=0 THEN
  3473.                         DO
  3474.                           CALL readlines(arg 1)
  3475.                           CALL movefile(brfilenum dirs.dirnum)
  3476.                         END
  3477.                     END
  3478.                 END
  3479.               ELSE
  3480.                 DO
  3481.                   mvdir=STRIP(mvdir)
  3482.                   IF UPPER(mvdir)~=UPPER(WORD(files.brfilenum,1)) THEN
  3483.                     DO
  3484.                       DO mj=1 TO level+1
  3485.                         IF UPPER(mvdir)=UPPER(dirs.mj) THEN LEAVE mj
  3486.                       END
  3487.                       IF mj<=level THEN CALL movefile(brfilenum mvdir)
  3488.                     END
  3489.                 END
  3490.             END
  3491.           IF savefileflag>0 THEN CALL savefilelist()
  3492.           CALL setdir(curdir)
  3493.         END
  3494.       ELSE IF brcom='N' THEN
  3495.         DO
  3496.           brfilenum=brfilenum-1
  3497.           nonstop=1
  3498.           SAY pen3'To EXIT non-stop scrolling of text, press CTRL-E'def
  3499.           SAY
  3500.           CALL DELAY(99)
  3501.           brcom=''
  3502.         END
  3503.       ELSE IF brcom='C' THEN
  3504.         DO
  3505.           temp=STRIP(WORD(STATEF(arg),8))
  3506.           IF temp='' THEN temp=libpath||plaindir'/'argname
  3507.           CALL Contents.rexx(temp)
  3508.           IF EXISTS('RAM:CONTENTS') THEN
  3509.             DO
  3510.               CALL showtext('RAM:CONTENTS' 0)
  3511.               IF waitchar~='Q' THEN CALL waiting()
  3512.               nonstop=0
  3513.             END
  3514.           ELSE SAY pen3'Not an archived file.'def
  3515.         END
  3516.       ELSE IF brcom='D' THEN
  3517.         DO
  3518.           arg2=arg
  3519.           arg=brfilenum
  3520.           CALL dload()
  3521.           arg=arg2
  3522.         END
  3523.       ELSE IF brcom='E' THEN
  3524.         DO
  3525.           IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3526.             DO
  3527.               firstedit=5
  3528.               IF level>sysoplevel THEN firstedit=1
  3529.               CALL bbsEd.rexx(firstedit arg name)
  3530.               CALL checkfilechanges()
  3531.             END
  3532.         END
  3533.       ELSE IF brcom='K' THEN
  3534.         DO
  3535.           IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3536.             DO
  3537.               IF getinput(1 1 pen3'Do you really want to kill this file? (nY) >'def)~='N' THEN
  3538.                 DO
  3539.                   tempnum=WORD(lynes.1,2)
  3540.                   IF tempnum=lastfile THEN
  3541.                     DO
  3542.                       CALL DELETE(bbspath'Numbers/LastFile')
  3543.                       CALL DELAY(28)
  3544.                       lastfile=lastfile-1
  3545.                       CALL countcheck('LastFile' lastfile)
  3546.                     END
  3547.                   files.tempnum=''
  3548.                   tempnum2=files.tempnum.0
  3549.                   alpha.tempnum2='0 0' tempnum '100'
  3550.                   savefileflag=1
  3551.                   CALL savefilelist()
  3552.                   finfo=STATEF(arg)
  3553.                   IF WORDS(finfo)>7 THEN argname=WORD(finfo,8)
  3554.                   CALL DELETE(argname)
  3555.                   CALL DELETE(arg)
  3556.                   SAY argname pen3'has been deleted.'def
  3557.                   CALL DELETE(libpath||plaindir'/.'STRIP(LEFT(plaindir,15)))
  3558.                 END
  3559.             END
  3560.         END
  3561.       ELSE IF brcom='R' & (endtest='.TXT' | UPPER(argname)='.'UPPER(STRIP(LEFT(plaindir,15)))) THEN
  3562.         DO
  3563.           vcount=WORD(lynes.2,7)+1
  3564.           lynes.2=STRIP(DELWORD(lynes.2,7,1)) vcount
  3565.           edtype=''
  3566.           CALL savelines(arg)
  3567.           CALL showtext(argname 1)
  3568.         END
  3569.       ELSE brfilenum=brfilenum-1
  3570.     END
  3571. END
  3572. CALL setdir(brdir)
  3573. waitchar=''
  3574. IF nonstop THEN CALL waiting()
  3575. nonstop=0
  3576. CALL savedata(0)
  3577. RETURN
  3578.  
  3579.  
  3580. movefile:
  3581. PARSE ARG fnum movdir .
  3582. fromdir=STRIP(WORD(files.fnum,1))
  3583. farg=STRIP(WORD(files.fnum,2))
  3584. md=libpath||movdir
  3585. mf=md'/'farg
  3586. fd=libpath||fromdir
  3587. ff=fd'/'farg
  3588. CALL DELETE(md'/.'STRIP(LEFT(movdir,15)))
  3589. CALL DELETE(fd'/.'STRIP(LEFT(fromdir,15)))
  3590. fn=bbspath'FileNotes/'fromdir'/'farg
  3591. commen=WORD(STATEF(fn),8)
  3592. IF commen~='' THEN
  3593.   DO
  3594.     ff=commen
  3595.     n=LASTPOS('/',ff)
  3596.     IF n>1 THEN
  3597.       DO
  3598.         xf=SUBSTR(ff,n+1)
  3599.         tfd=LEFT(ff,n-1)
  3600.         n=LASTPOS('/',tfd)
  3601.         IF n=0 THEN n=LASTPOS(':',tfd)
  3602.         IF n>0 THEN
  3603.           DO
  3604.             tmd=LEFT(tfd,n)||movdir
  3605.             SAY 'Rename external file'pen3 ff||def
  3606.             IF getinput(1 1 '                  to'pen3 tmd'/'farg||def'? (Ny) > ')='Y' THEN
  3607.               DO
  3608.                 fd=tfd
  3609.                 md=tmd
  3610.                 mf=md'/'farg
  3611.                 commen=md'/'xf
  3612.               END
  3613.             ELSE IF getinput(1 1 '          or move to'pen3 mf||def'? (Ny) > ')='Y' THEN
  3614.               DO
  3615.                 fd=tfd
  3616.                 commen=''
  3617.               END
  3618.           END
  3619.       END
  3620.   END
  3621. CALL MAKEDIR(md)
  3622. IF RENAME(ff,mf)=0 THEN
  3623.   DO
  3624.     ADDRESS COMMAND 'C:COPY' ff mf
  3625.     IF EXISTS(mf) THEN
  3626.       IF DELETE(ff)~=1 THEN SAY pen3'Unable to delete'def ff||pen3'.'def
  3627.   END
  3628. files.fnum=movdir farg
  3629. lynes.3=DELWORD(lynes.3,WORDS(lynes.3),1)
  3630. lynes.3=STRIP(lynes.3) movdir
  3631. CALL MAKEDIR(bbspath'FileNotes/'movdir)
  3632. mn=bbspath'FileNotes/'movdir'/'farg
  3633. CALL savelines(mn)
  3634. ndx=files.fnum.0
  3635. dnum=finddirnum(movdir)
  3636. alpha.ndx=OVERLAY(RIGHT(dnum,2) movdir,alpha.ndx,31,15)
  3637. IF EXISTS(mn) THEN
  3638.   DO
  3639.     CALL DELETE(fn)
  3640.     IF commen~='' THEN ADDRESS COMMAND 'C:FileNote' mn commen
  3641.   END
  3642. savefileflag=1
  3643. line='Moved:' fromdir'/'farg 'to' movdir
  3644. SAY line
  3645. RETURN
  3646.  
  3647.  
  3648. textsearch:
  3649. ARG sfile' 'sarg
  3650. IF sarg='' THEN RETURN 0
  3651. x=OPEN(f,sfile,'R')
  3652. IF x=0 THEN RETURN 0
  3653. stemp=UPPER(READCH(f,65000))
  3654. CALL CLOSE(f)
  3655. retflag=0
  3656. IF POS(sarg,stemp)>0 THEN retflag=1
  3657. RETURN retflag
  3658.  
  3659.  
  3660. bbsSEARCH:
  3661. smenu=menu
  3662. test=UPPER(LEFT(arg,1))
  3663. IF test='F' THEN smenu='FILE'
  3664. IF test='M' THEN smenu='MSG'
  3665. IF test='U' THEN smenu='MAIN'
  3666. IF smenu='ALL' THEN
  3667.   DO
  3668.     junk=getinput(1 1 'Search ['pen3'F'def']iles ['pen3'M'def']essages or ['pen3'U'def']sers (fmu) > ')
  3669.     IF junk='F' THEN smenu='FILE'
  3670.     ELSE IF junk='M' THEN smenu='MSG'
  3671.     ELSE IF junk='U' THEN smenu='MAIN'
  3672.     ELSE RETURN
  3673.   END
  3674. IF WORDS(arg)>1 THEN searcharg=UPPER(SUBSTR(arg,WORDINDEX(arg,2)))
  3675. ELSE searcharg=getinput(0 0 pen3'Search Phrase: 'def)
  3676. IF LENGTH(STRIP(searcharg))=0 THEN RETURN
  3677. searcharg=COMPRESS(searcharg,'*')
  3678. IF smenu='NEW' | smenu='MAIN' THEN
  3679.   DO
  3680.     SAY 'Searching Userlist...'
  3681.     CALL FileList(bbspath'Users/*'searcharg'*',sl)
  3682.     SAY 'Found' sl.0 'matches                    '
  3683.     DO i=1 TO sl.0
  3684.       SAY sl.i
  3685.       IF ~nonstop THEN
  3686.         IF i//linesperpage=0 THEN
  3687.           IF waiting2() THEN LEAVE i
  3688.     END
  3689.     DROP sl.
  3690.   END
  3691. IF smenu='MSG' THEN
  3692.   DO
  3693.     CALL SETCLIP('BBSMSG_SEARCH',searcharg)
  3694.     SAY lm
  3695.     CALL bbsMsg.rexx(3000 name password) 
  3696.   END
  3697. IF smenu='FILE' THEN
  3698.   DO
  3699.     lne=pen3'Searching'
  3700.     curdironly=0
  3701.     IF getinput(1 1 'Search one library only? (Ny) > ')='Y' THEN
  3702.       DO
  3703.         IF chdir()>0 THEN RETURN
  3704.         curdironly=1
  3705.         lne=lne 'the'def plaindir pen3'library'
  3706.         SAY
  3707.       END
  3708.     ELSE
  3709.       DO
  3710.         lne=lne 'all file libraries'
  3711.         SAY
  3712.         SAY pen3'WARNING!'def 'Searching' RIGHT(files.0,5) '['pen3'F'def']ull descriptions may take'pen3 TRUNC(files.0/(114*cpu)+.05,1) def'minutes!'
  3713.       END
  3714.     test=getinput(1 1 '   ['pen3'A'def']lphaList search or ['pen3'F'def']ull descriptions? (Afq) > ')
  3715.     IF test='Q' THEN RETURN
  3716.     SAY
  3717.     SAY lne 'for'def UPPER(searcharg)
  3718.     SAY pen3' - To ABORT, press CTRL-E -'def
  3719.     SAY
  3720.     IF test~='F' THEN
  3721.       DO
  3722.         CALL fileheader()
  3723.         IF curdironly=1 THEN
  3724.           DO
  3725.             af=libpath||dirs.dirnum'/.'STRIP(LEFT(dirs.dirnum,15))
  3726.             IF EXISTS(af) THEN
  3727.               DO
  3728.                 CALL readlines(af 1)
  3729.                 DO i=1 TO lynes.0
  3730.                   CALL busywait(8 i lynes.0)
  3731.                   tempnum=POS(UPPER(searcharg),UPPER(lynes.i))
  3732.                   IF tempnum>0 THEN
  3733.                     DO
  3734.                       CALL busywait(4 0)
  3735.                       SAY lynes.i
  3736.                       SAY pen3||LEFT(' ',tempnum-1)||lineup||UPPER(searcharg)||def
  3737.                       CALL busywait(4 1)
  3738.                     END
  3739.                 END
  3740.               END
  3741.           END
  3742.         IF curdironly=0 | ~EXISTS(af) THEN
  3743.           DO i=1 TO alpha.0
  3744.             CALL busywait(60 i alpha.0)
  3745.             ii=WORD(alpha.i,4)
  3746.             IF ii>level THEN ITERATE i
  3747.             IF curdironly=1 & ii~=dirnum THEN ITERATE i
  3748.             ii=WORD(alpha.i,3)
  3749.             IF POS(UPPER(WORD(files.ii,1)),data.21)>0 THEN ITERATE i
  3750.             tempnum=POS(UPPER(searcharg),UPPER(alpha.i))
  3751.             IF tempnum>0 THEN
  3752.               DO
  3753.                 CALL busywait(4 0)
  3754.                 SAY alpha.i
  3755.                 SAY pen3||LEFT(' ',tempnum-1)||lineup||UPPER(searcharg)||def
  3756.                 CALL busywait(4 1)
  3757.               END
  3758.           END
  3759.       END
  3760.     ELSE
  3761.       DO
  3762.         cck=countcheck('LastFile' 0)
  3763.         nonstop=1
  3764.         DO i=1 TO cck
  3765.           iii=cck+1-i
  3766.           IF files.iii='' THEN ITERATE i
  3767.           ii=files.iii.0
  3768.           ii=WORD(alpha.ii,4)
  3769.           IF ii>level THEN ITERATE i
  3770.           IF curdironly=1 & ii~=dirnum THEN ITERATE i
  3771.           IF POS(UPPER(WORD(files.iii,1)),data.21)>0 THEN ITERATE i
  3772.           farg=WORD(files.iii,1)'/'WORD(files.iii,2)
  3773.           SAY '1B'x'M' RIGHT(farg,40) LEFT(iii,7)
  3774.           IF textsearch(bbspath'FileNotes/'farg searcharg) THEN
  3775.             DO
  3776.               savei=i
  3777.               CALL readlines(bbspath'FileNotes/'farg 1)
  3778.               nonstop=1
  3779.               CALL seelines(2)
  3780.               i=savei
  3781.               SAY
  3782.               SAY
  3783.             END
  3784.         END
  3785.       END
  3786.     CALL busywait(4 0)
  3787.   END
  3788. searcharg=''
  3789. nonstop=0
  3790. SAY
  3791. IF i<999999 THEN SAY 'All available items have been searched.'
  3792. SAY
  3793. CALL waiting()
  3794. RETURN
  3795.  
  3796.  
  3797. finddirnum:
  3798. ARG fdirname .
  3799. DO fdir=1 TO 99
  3800.   IF UPPER(dirs.fdir)=UPPER(fdirname) THEN RETURN fdir
  3801. END
  3802. RETURN 100
  3803.  
  3804.  
  3805. writebuffer:
  3806. PARSE ARG bufname .
  3807. CALL DELETE(bufname)
  3808. startnum=lynes.0+1
  3809. OPTIONS PROMPT ''
  3810. SAY pen3'LOCAL logon! Input cannot exceed 250 characters per line!'def
  3811. SAY 'Type 'pen3'/E'def 'or' pen3'/S'def' on a new line to exit and' pen3'DO YOUR OWN WORDWRAP!'def
  3812. DO bufloop=startnum
  3813.   PARSE PULL line
  3814.   IF LEFT(UPPER(STRIP(line)),2)='/E' | LEFT(UPPER(STRIP(line)),2)='/S' THEN
  3815.     LEAVE bufloop
  3816.   lynes.bufloop=line
  3817. END
  3818. lynes.0=bufloop-1
  3819. CALL wrapbuf(startnum)
  3820. CALL DELETE(bufname)     /* these 4 lines make wordwrap more consistent */
  3821. CALL savelines(bufname)
  3822. CALL readlines(bufname 1)
  3823. CALL wrapbuf(startnum)
  3824. RETURN
  3825.  
  3826.  
  3827. wrapbuf:
  3828. ARG startnum .
  3829. CALL cleanline(1)
  3830. IF startnum>=lynes.0 & LENGTH(lynes.startnum)<80 THEN RETURN
  3831. SAY pen3'Wordwrapping...'def
  3832. lynes.startnum=TRANSLATE(lynes.startnum,' ','09'x)
  3833. lynes.startnum=COMPRESS(lynes.startnum,'0C'x)  /* no FF */
  3834. DO wi=startnum WHILE wi<=lynes.0
  3835.   wj=wi+1
  3836.   lynes.wj=COMPRESS(lynes.wj,'08'x||'0C'x||'7F'x)
  3837.   tabpos=POS('09'x,lynes.wi)
  3838.   DO WHILE tabpos>0
  3839.     lynes.wi=DELSTR(lynes.wi,tabpos,1)
  3840.     lynes.wi=INSERT('  ',lynes.wi,tabpos-1)
  3841.     tabpos=POS('09'x,lynes.wi)
  3842.   END
  3843.   IF LENGTH(lynes.wi)>75 THEN
  3844.     DO
  3845.       testchar=''
  3846.       IF lynes.wj~='' THEN testchar=LEFT(lynes.wj,1)
  3847.       IF testchar=' ' | testchar='.' | testchar=':' THEN
  3848.         DO
  3849.           DO wjj=lynes.0 TO wi+1 BY -1
  3850.             wk=wjj+1
  3851.             lynes.wk=lynes.wjj
  3852.           END
  3853.           lynes.wj=''
  3854.           lynes.0=lynes.0+1
  3855.         END
  3856.       DO wl=WORDS(lynes.wi) TO 1 BY -1 WHILE LENGTH(lynes.wi)>74
  3857.         IF WORDS(lynes.wi)=1 THEN
  3858.           lynes.wi=LEFT(lynes.wi,74) SUBSTR(lynes.wi,75)
  3859.         lynes.wj=WORD(lynes.wi,wl) lynes.wj
  3860.         lynes.wi=STRIP(DELWORD(lynes.wi,wl,1))
  3861.       END
  3862.     END
  3863. END
  3864. RETURN
  3865.  
  3866.  
  3867. seelines:
  3868. ARG fancy .
  3869. DO i=1 TO lynes.0
  3870.   IF fancy=0 THEN SAY lynes.i||def
  3871.   ELSE
  3872.     DO
  3873.       IF LEFT(lynes.i,2)=': ' & WORDS(lynes.i)=2 THEN ITERATE i
  3874.       ELSE IF LEFT(lynes.i,10)='Directory ' | LEFT(lynes.i,5)='=====' THEN
  3875.         SAY pen3||lynes.i||def
  3876.       ELSE SAY lynes.i
  3877.       IF fancy=2 & colorflag=1 THEN
  3878.         DO
  3879.           IF searcharg~='' THEN
  3880.             DO
  3881.               testpos=POS(UPPER(searcharg),UPPER(lynes.i))
  3882.               IF testpos>0 THEN
  3883.                 SAY LEFT(' ',testpos-1)||pen3||lineup||UPPER(searcharg)||def
  3884.             END
  3885.           IF i=1 THEN
  3886.             IF WORD(lynes.1,3)='Reply' THEN
  3887.               DO
  3888.                 testpos=WORDINDEX(lynes.1,3)
  3889.                 SAY LEFT(' ',testpos-1)||pen3||lineup||SUBSTR(lynes.1,testpos)||def
  3890.               END
  3891.         END
  3892.     END
  3893.   IF i//linesperpage=0 & i<lynes.0 THEN
  3894.     IF waiting2() THEN LEAVE i
  3895. END
  3896. nonstop=0
  3897. RETURN
  3898.  
  3899.  
  3900. readlines:
  3901. CALL CLOSE(f)
  3902. PARSE ARG tempname readstart .
  3903. IF ~readopen(tempname) THEN RETURN 1
  3904. IF readstart<2 THEN lynes.=''
  3905. DO ri=readstart
  3906.   line=READLN(f)
  3907.   IF EOF(f) THEN BREAK
  3908.   lynes.ri=line
  3909. END
  3910. lynes.0=ri-1
  3911. CALL CLOSE(f)
  3912. DO ri=lynes.0 TO 0 BY -1 WHILE LENGTH(lynes.ri)=0 | LEFT(UPPER(lynes.ri),2)='/E' | LEFT(UPPER(lynes.ri),2)='/S'
  3913. END
  3914. lynes.0=ri
  3915. RETURN 0
  3916.  
  3917.  
  3918. savelines:
  3919. PARSE ARG tempname .
  3920. IF EXISTS(tempname) & edtype='MAIL' THEN
  3921.   DO
  3922.     ok=OPEN(f,tempname,'A')
  3923.     IF ok~=0 THEN CALL WRITELN(f,LEFT('',74,'^'))
  3924.   END
  3925. ELSE ok=OPEN(f,tempname,'W')
  3926. IF ok=0 THEN
  3927.   DO
  3928.     line='***' tempname 'failed to open for saving!'
  3929.     SAY line
  3930.     RETURN 1
  3931.   END
  3932. DO wi=1 TO lynes.0
  3933.   CALL WRITELN(f,lynes.wi)
  3934. END
  3935. CALL CLOSE(f)
  3936. RETURN 0
  3937.  
  3938.  
  3939. sortuserlist:
  3940. uf=bbspath'Lists/USERS'
  3941. IF sortuserflag THEN CALL DELETE(uf)
  3942. sortuserflag=0
  3943. IF ~EXISTS(uf) THEN
  3944.   DO
  3945.     users=bbsSortUsers.rexx(bbspath bbsname)
  3946.     RETURN
  3947.   END
  3948. ELSE
  3949.   DO
  3950.     IF OPEN(f,uf,'R')=0 THEN RETURN
  3951.     users=0
  3952.     DO i=1
  3953.       dat=READCH(f,65000)
  3954.       IF EOF(f) THEN LEAVE i
  3955.       users=users+WORDS(dat)
  3956.     END
  3957.     CALL CLOSE(f)
  3958.   END
  3959. SAY CENTER(RIGHT(users,8) 'Users on'pen3 bbsname,74)||def
  3960. RETURN
  3961.  
  3962.  
  3963. showuserlist:
  3964. IF data.5='' THEN line='Here are the EMail names of your fellow users.'
  3965. ELSE line='   'users 'users. Use these names to address messages.'
  3966. SAY pen3||line||def
  3967. CALL showtext(bbspath'Lists/USERS' 1)
  3968. IF data.5~='' THEN CALL waiting()
  3969. RETURN
  3970.  
  3971.  
  3972. msgcount:
  3973. ARG countdir .
  3974. lastmess=0
  3975. totmsgs=0
  3976. unred=0
  3977. IF ~EXISTS(msgpath||countdir) THEN RETURN
  3978. IF STATEF(msgpath||countdir)=msg.countdir.1 THEN totmsgs=msg.countdir.0
  3979. ELSE
  3980.   DO
  3981.     totmsgs=WORDS(SHOWDIR(msgpath||countdir))
  3982.     msg.countdir.0=totmsgs
  3983.     msg.countdir.1=STATEF(msgpath||countdir)
  3984.   END
  3985. IF countdir>level | FIND(data.21,i)>0 THEN RETURN
  3986. lastread.countdir=WORD(data.22,countdir)
  3987. IF ~DATATYPE(lastread.countdir,'W') THEN lastread.countdir=0
  3988. lastmess=countcheck('LastMessage'countdir 0)
  3989. IF lastread.countdir<0 THEN RETURN
  3990. firstmess=countcheck('FirstMessage'countdir 0)
  3991. IF lastread.countdir<firstmess THEN lastread.countdir=firstmess-1
  3992. IF lastmess>0 THEN
  3993.   IF lastread.countdir>=0 THEN
  3994.     DO
  3995.       IF lastread.countdir<(firstmess-1) THEN lastread.countdir=firstmess-1
  3996.       unred=lastmess-lastread.countdir
  3997.       IF unred>totmsgs THEN unred=totmsgs
  3998.       IF unred>0 | ~logonflag THEN
  3999.         DO
  4000.           cline=RIGHT(unred,5) 'new of' RIGHT(lastmess,5) 'messages,'
  4001.           cline=cline RIGHT(totmsgs,5) 'still online in' 
  4002.           cline=cline RIGHT(countdir,2)',' msg.countdir
  4003.           SAY pen6||cline||def
  4004.         END
  4005.     END
  4006. RETURN
  4007.  
  4008.  
  4009. counts:
  4010. SAY
  4011. SAY 'Working...'
  4012. SAY
  4013. temp=''
  4014. DO i=1 TO 4
  4015.   temp=temp||CENTER(copyright.i,75)||'0A'x
  4016. END
  4017. CALL SETCLIP('BBS_copyright',temp)
  4018. IF emailonline<0 THEN CALL countmail()
  4019. CALL bbsSTATS.rexx(name colorflag 0 emailonline grand grand2 files.0 users)
  4020. SAY
  4021. CALL waiting2()
  4022. IF waitchar='Q' THEN RETURN
  4023. CALL showmarked(1)
  4024. CALL logonstats()
  4025. nonstop=0
  4026. CALL waiting()
  4027. RETURN
  4028.  
  4029.  
  4030. countmail:
  4031. SAY '   Counting online email...'lineup
  4032. emailonline=0
  4033. t=SHOWDIR(bbspath'Users')
  4034. DO ti=1 TO WORDS(t)
  4035.   emailonline=emailonline+WORDS(SHOWDIR(bbspath'Email/'WORD(t,ti)))
  4036. END
  4037. SAY lineup'       'emailonline' letters online.'
  4038. RETURN
  4039.  
  4040.  
  4041. hourly:
  4042. IF level=99 & nonstop~=1 THEN
  4043.   DO
  4044.     IF getinput(1 1 'Zero The Hourly Averages? (Ny) > ')='Y' THEN
  4045.       ADDRESS COMMAND 'C:Delete >*' bbspath'Numbers/Hourly/#?'
  4046.     CALL cleanline(1)
  4047.   END
  4048. SAY lm
  4049. CALL ShowHourly.rexx(name linesperpage colorflag nonstop)
  4050. RETURN
  4051.  
  4052.  
  4053. logonstats:
  4054. IF level=0 THEN RETURN
  4055. SAY bak2||name||def 'Last on' DATE('W',lastondate,'I') DATE(,lastondate,'I') lastontime
  4056. tempnum=countcheck('LastFile' 0)-lastbrowse
  4057. IF tempnum>files.0 THEN tempnum=files.0
  4058. line=RIGHT(countcheck('LastFile' 0),5) 'uploaded,'
  4059. line=line RIGHT(files.0,5) 'files online.'
  4060. IF tempnum>0 THEN SAY RIGHT(tempnum,5) 'new of' line
  4061. ELSE SAY '   No new of' line
  4062. totmsg=0
  4063. grand=0
  4064. grand2=0
  4065. DO i=1 TO 99
  4066.   IF msg.i='' THEN ITERATE i
  4067.   CALL msgcount(i)
  4068.   totmsg=totmsg+unred
  4069.   grand=grand+totmsgs
  4070.   grand2=grand2+lastmess
  4071. END
  4072. line=RIGHT(grand2,5) 'messages,' RIGHT(grand,5) 'still online.' 
  4073. IF totmsg>0 THEN SAY RIGHT(totmsg,5) 'new of' line
  4074. ELSE SAY '   No new of' line
  4075. RETURN
  4076.  
  4077.  
  4078. readopen:
  4079. PARSE ARG fname
  4080. ok=OPEN(f,fname,'R')
  4081. IF ok~=0 THEN RETURN 1
  4082. line=fname 'failed to open for reading!'
  4083. SAY line
  4084. RETURN 0
  4085.  
  4086.  
  4087. writeopen:
  4088. PARSE ARG fname
  4089. CALL CLOSE(f)
  4090. ok=OPEN(f,fname,'W')
  4091. IF ok~=0 THEN RETURN 1
  4092. line=fname 'failed to open for writing!'
  4093. SAY line
  4094. RETURN 0
  4095.  
  4096.  
  4097. set_grand:
  4098. SAY 'Setting up public message conferences...'
  4099. grand=0
  4100. DO i=1 TO 99
  4101.   IF msg.i='' THEN ITERATE i
  4102.   msg.i.0=WORDS(SHOWDIR(msgpath||i,'F'))
  4103.   msg.i.1=STATEF(msgpath||i)
  4104.   grand=grand+msg.i.0
  4105. END
  4106. RETURN
  4107.  
  4108.  
  4109. SYNTAX:
  4110. FAILURE:
  4111. lin.1=''ERRORTEXT(RC)''
  4112. lin.2=SIGL-1     SOURCELINE(SIGL-1)
  4113. lin.3=SIGL ''SOURCELINE(SIGL)''
  4114. lin.4=SIGL+1     SOURCELINE(SIGL+1)
  4115. DO er=1 TO 4
  4116.   SAY lin.er
  4117. END
  4118. IF newpassword='' THEN SIGNAL DONE2  /* no user logged on, quit quietly */
  4119. CALL CLOSE(f)
  4120. IF level>sysoplevel THEN
  4121.   DO
  4122.     junk=getinput(1 1 'ReStart: (Ny) > ')
  4123.     IF junk~='Y' THEN SIGNAL LOGOUT
  4124.   END
  4125. string=''
  4126. waitchar=''
  4127. IF data.1~='' & data.5~='' & data.20~='' THEN CALL savedata(0)
  4128. SIGNAL RESTART
  4129.  
  4130.  
  4131. BREAK_E:
  4132. CALL CLOSE(f)
  4133. SAY pen3'*** CTRL-E BREAK ***'def
  4134. waitchar=''
  4135. string=''
  4136. nonstop=0
  4137. rnonstop=0
  4138. brostop=0
  4139. i=999999
  4140. wi=999999
  4141. ni=-1
  4142. SAY
  4143. RETURN 0
  4144.  
  4145.  
  4146. BREAK_C:
  4147. CALL CLOSE(f)
  4148.  
  4149. LOGOUT:
  4150. LOGOUT2:
  4151. secs=TIME('E')
  4152. mins=secs%60
  4153. secs=TRUNC(secs//60)
  4154. IF secs<10 THEN secs='0'secs
  4155. SAY
  4156. SAY 'Public messages now online: 'RIGHT(comma(grand),9)
  4157. SAY 'Public    files now online: 'RIGHT(comma(files.0),9)
  4158. SAY
  4159. SAY 'Time used this call:' mins':'secs
  4160. SAY
  4161. arg=bbspath'BBS_TEXT/GOODBYE'
  4162. IF EXISTS(arg) THEN
  4163.   DO
  4164.     CALL DELAY(14)
  4165.     nonstop=1
  4166.     CALL showtext(arg 0)
  4167.     nonstop=0
  4168.   END
  4169. SAY
  4170. IF bbsprefs.2 THEN CALL doGrin()
  4171. SAY 
  4172. IF EXISTS('rexx:bbsLOGOFF.rexx') THEN CALL bbsLOGOFF.rexx(name level 0)
  4173.  
  4174. OUT:
  4175. data.18=winnings
  4176.  
  4177. OUT2:
  4178.  
  4179. DONE:
  4180.  
  4181. DONE2:
  4182. CALL SETCLIP('BBS_LOCAL')
  4183. CALL SETCLIP('BBS_LOCAL_MSG')
  4184. IF newfilesflag=1 THEN
  4185.   DO
  4186.     newfilesdate=DATE('S') TIME()
  4187.     lastbrowse=countcheck('LastFile' 0)
  4188.   END
  4189. IF clear_marked=1 THEN data.24=''
  4190. CALL saveData(0)
  4191. IF EXISTS(bbspath'EmailFiles/'name'/QUICKIN.lha') THEN
  4192.   DO
  4193.     IF sortalphaflag>0 | savefileflag>0 THEN
  4194.       CALL SETCLIP('BBS_QUICK_WAIT',1)
  4195.     ADDRESS AREXX bbsQUICKIN.rexx name level sysoplevel bbsprefs.6
  4196.   END
  4197. IF sortuserflag=1 THEN
  4198.   DO
  4199.     CALL sortuserlist()
  4200.     IF SHOW('P','BBBBS') THEN
  4201.       DO
  4202.         CALL SETCLIP('BBS_mainusers')
  4203.         CALL SETCLIP('BBS_localusers',1)
  4204.       END
  4205.     sortuserflag=0
  4206.   END
  4207. IF sortalphaflag>0 | savefileflag>0 | GETCLIP('BBS_resave_local')~='' THEN
  4208.   DO
  4209.     loadalphaflag=0
  4210.     x=GETCLIP('BBS_resave_local')
  4211.     IF savefileflag>0 THEN CALL savefilelist2()
  4212.     ELSE IF x='' THEN CALL savealphalist()
  4213.     x=GETCLIP('BBS_resave_local')
  4214.     CALL SETCLIP('BBS_resave_local')
  4215.     IF x=1 THEN
  4216.       DO
  4217.         sortalphaflag=1
  4218.         savefileflag=1
  4219.         SIGNAL DONE2
  4220.       END
  4221.     IF SHOW('P','BBBBS') THEN CALL SETCLIP('BBS_localfiles',2)
  4222.     CALL SETCLIP('BBS_QUICK_WAIT')
  4223.   END
  4224. IF getinput(1 1 'Reset for next local user? (nY) > ')='N' THEN EXIT
  4225. clear_marked=0
  4226. data.=''
  4227. IF loadalphaflag=1 THEN CALL loadalpha(1)
  4228. SIGNAL BIG_LOOP
  4229.  
  4230.  
  4231. checkclips:
  4232. IF GETCLIP('BBS_mainusers')~='' THEN
  4233.   DO
  4234.     CALL sortuserlist()
  4235.     CALL SETCLIP('BBS_mainusers')
  4236.   END
  4237. IF GETCLIP('BBS_mainfiles')~='' THEN
  4238.   DO
  4239.     CALL SETCLIP('BBS_mainfiles')
  4240.     CALL loadfiles()
  4241.     CALL loadalpha(1)
  4242.   END
  4243. RETURN
  4244.  
  4245.  
  4246. checkalias:
  4247. addressee=''
  4248. IF alias.0=0 THEN RETURN 0
  4249. DO i=1 TO alias.0
  4250.  IF UPPER(alias.i)=UPPER(string) THEN
  4251.   DO
  4252.    addressee=realname.i
  4253.    LEAVE i
  4254.   END
  4255. END
  4256. IF addressee='' THEN RETURN 0
  4257. string=''
  4258. SAY pen3'Email to 'def||addressee
  4259. CALL editor('MAIL' addressee)
  4260. RETURN 0
  4261.  
  4262. /* bbsLOCAL.rexx */
  4263.